Ad

Image File Upload Error: Unable To Read Image From File () - Laravel 5

- 1 answer

Having issues with the intervention Image package for laravel.

I have a simple form which accepts an image, I then take that image and fit it, and move save it to a new location. I then persist the file path into the database.

on my local machine I run xampp with php7 and everything runs fine.

However, when I upload my changes to my remote host, I get this error when submitting the form:

NotReadableException in Decoder.php line 21:
Unable to read image from file ().

Here is the code which I use:

$file = $request->file('profile-picture');

$destinationPath = 'uploads/';

$filename = md5(microtime() . $file->getClientOriginalName()) . "." . $file->getClientOriginalExtension();

$path = $destinationPath.$filename;

Image::make($file)->fit(300)->save($path);  

My remote host is running windows server 2012 with IIS 8.

As I say, this runs perfectly on my local machine with xampp, which leads me to believe that there is some sort of permission issue on my remote host.

I've checked the folder permissions on the '/uploads' folder, and they seem fine as far as I am aware. Could there be an issue with permissions on the temp folder the image first gets uploaded to?

Ad

Answer

Had a look in the php.ini file to see what the temp folder was set at, it was in C:\Windows\temp

Changed it to somewhere else and that has seemed fix this issue.

Ad
source: stackoverflow.com
Ad