Could it be folder permissions?
File upload using nginx and php5-fpm
I have made a lethal mistake which is using MAMP for development and nginx for production. Anyway i ll move everything to homestead as i should have done right from the very start. So my issue is that i cannot upload files in production env while everything works perfect in dev env with Apache. I am using Laravel 5.2 and AngularJS with ng-file-upload plugin to make the uploading process smoother. My form has enctype="multipart/form-data" as it should. Frontend code works fine i guess because this runs perfectly in dev env and uploads the files as wanted. This is my payload:
------WebKitFormBoundaryajLr6B6CB99Q8P5G
Content-Disposition: form-data; name="file"; filename="6667062225_a758283450e487f6e8e8_192.jpg"
Content-Type: image/png
------WebKitFormBoundaryajLr6B6CB99Q8P5G--
In my controller for debugging purposes i am using:
$file = $request->file('file');
return dd($file);
This returns null in nginx production server and the wanted Symfony\Component\HttpFoundation\File\UploadedFile instance in my Apache dev server. I 've checked php.ini and the usual upload_max_filesize = 2M and post_max_size = 8M default settings are there which are fine since i am trying to upload really small images. Any ideas?
So i figured this out and i want to share the solution. I was using ng-file-upload with PUT method in dev env. When i switched this to POST it worked fine even in production server.
Please or to participate in this conversation.