getimagesize() error: "failed to open stream: No such file or directory"

28.7k Views Asked by At

I get the following error:

getimagesize(barbie2.jpeg) [function.getimagesize]: failed to open stream: No such file or directory

On line:

list($hight, $width) = getimagesize($name);
2

There are 2 best solutions below

1
Rukmi Patel On

in getimagesize() you need to specify path of the image. Probably it is not getting image path so it is giving you error.

your file from where you have called this function and image location is different so it is giving you error.

0
Anthony On

You can specify the path of the image by using $_FILES["fileToUpload"]["tmp_name"] because when you upload the file is stored in the temp directory.