2

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);
hakre
  • 193,403
  • 52
  • 435
  • 836
Karthika
  • 37
  • 2
  • 2
  • 3
  • is this an uploaded file? is the file "barbie2.jpeg" is in the same directly as your php file? – Sufendy Oct 25 '11 at 05:25
  • Related: [Reference - What does this error mean in PHP?](http://stackoverflow.com/q/12769982/367456) – hakre Dec 24 '12 at 11:28

2 Answers2

8

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.

BenMorel
  • 34,448
  • 50
  • 182
  • 322
Rukmi Patel
  • 2,619
  • 9
  • 29
  • 41
  • Thats sounds great. I just used this function to find height and width of an uploaded image. Tried with file name only. That is what happened. – Karthika Oct 25 '11 at 05:36
4

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.

Anthony
  • 151
  • 1
  • 2