I'm trying to use the getimagesize()
function on an image uploading script.
Sometimes, on certain images, I get an error.
So I tried to investigate.
I used an image which seems to work, edited it with paint.exe, and saved it as a new jpg image.
When I look at the $_FILES[]
, I get this :
Original :
$_FILES : array(2) {
["thumb_a_uploader"]=> array(5) {
["name"]=> string(8) "1212.jpg"
["type"]=> string(10) "image/jpeg"
["tmp_name"]=> string(14) "/tmp/phprZ2H8G"
["error"]=> int(0)
["size"]=> int(90281)
}
Edited :
$_FILES : array(2) {
["thumb_a_uploader"]=> array(5) {
["name"]=> string(16) "1212 - Copy.jpg"
["type"]=> string(0) ""
["tmp_name"]=> string(0) ""
["error"]=> int(2)
["size"]=> int(0)
}
And for the edited one, the imagetype was wiped. I have the same problem with a picture taken with a smartphone.
Any ideas ?
You need to pay attention to ["error"]
.
["error"]=>
int(2)
UPLOAD_ERR_FORM_SIZE
Value:
2
; The uploaded file exceeds theMAX_FILE_SIZE
directive that was specified in the HTML form.
Learn more about php file-upload.errors