I am trying a simple upload from a file so that a country has a sound file for its anthem attached. I am using PHP 7.2.10 with Laravel 5.7.19.
My form includes a field named anthem and the form commences with
<form id="form-app" enctype="multipart/form-data"
method="post"
action="{{ route('storeCountryAnthemMPOnly',['id' => $co->id]) }}">
The route in web.php
is:
Route::post('storeCountryAnthemMPOnly/{id}',
'CountryController@storeCountryAnthemMPOnly')
->name('storeCountryAnthemMPOnly');
and my function in the controller is just:
public function storeCountryAnthemMPOnly(Request $request, $id)
{
dd($request);
}
When I press the submit button I am getting:
stream_socket_sendto(): A request to send or receive data was disallowed because the socket is not connected and (when sending on a datagram socket using a sendto call) no address was supplied.
I cannot understand this and help is greatly appreciated.
File can't be uploaded to the server and it is not the fault of laravel, but your server.
I had the same problem with the same environment. The thing was the file was too large, so it couldn't be uploaded to the temporary location. Although the file wasn't uploaded to the server, laravel still was trying to read it so this is why you get "no address was supplied"
.
In my case file couldn't be uploaded, because of exceeding size limits, but perhaps in your case, it is another reason why the file cannot be uploaded.
I solved it by changing size and memory limits in php.ini
.
memory_limit = 32M
upload_max_filesize = 24M
post_max_size = 32M
Besides size limits, I have one more suggestion: make sure that you have proper permissions to the folder with temporary uploads.
You can also check server logs.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With