1

I'm having a problem while using the getRealPath function.

$file = Input::file('archivo');
$img = Image::make($file->getRealPath());

I'm getting this exception:

NotReadableException in AbstractDecoder.php line 302. Image Not Readable.

I tried printing the value for $file->getRealPath() with dd() function and it prints false. Also I tried using dd(Input::hasFile( 'archivo' )) and that returned me true.

I can't seem to find an answer, I have tried almost everything I think.

So basically I want to know 2 things:

  1. Why is getRealPath returning me false and not the path?
  2. How am I supposed to send the route to Image::make(), I keep getting the annoying exception mentioned before even replacing getRealPath(), and sending instead the route as public_path()."routestring".
Bogdan
  • 43,166
  • 12
  • 128
  • 129
Aarón Gutiérrez
  • 1,400
  • 3
  • 16
  • 41
  • According to the documentation [`getRealPath`](http://php.net/manual/ro/splfileinfo.getrealpath.php) returns `false` when the file does not exit. Are you sure the file is uploaded correctly? What does `dump($file)` output? – Bogdan Oct 29 '15 at 18:46
  • Somehow the file isn't getting uploaded. Check your php.ini and mae sure file_uploads is on, the tmp directory is accessible by your webserver and the upload_max_filesize is appropriate. post_max_size might also have some effect – user1669496 Oct 29 '15 at 20:54
  • Hello, I noticed that the real problem was the `save()` function that wasn't working because the route I was trying to get wasn't correct, also, I avoided using `getRealPath()`, instead, it worked fine for me with the `public_path()` function. Thanks for your advices! – Aarón Gutiérrez Oct 29 '15 at 23:20

0 Answers0