Answer the question
In order to leave comments, you need to log in
How to validate images in PHP?
The $_FILES array contains:
array(1) {
["uploadfile"]=>
array(5) {
["name"]=>
string(9) "icons.png"
["type"]=>
string(9) "image/png"
["tmp_name"]=>
string(39) "/var/www/user/data/mod-tmp/HUFGGSHGDSF"
["error"]=>
int(0)
["size"]=>
int(6680)
}
}
Answer the question
In order to leave comments, you need to log in
PHP Uploading files - image only checking , although the official doc says that using getimagesize for checking is a bad idea:
Caution
This function expects filename to be a valid image file. If a non-image file is supplied, it may be incorrectly detected as an image and the function will return successfully, but the array may contain nonsensical values.
Do not use getimagesize() to check that a given file is a valid image. Use a purpose-built solution such as the Fileinfo extension instead.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question