问题
When I upload any file everything looks good. I have those pictures in pics folder. The unknown part is when I upload a bmp file. I check file types to see if they are jpg,gif, etc. But code doesn't reach there.
I've also echoed $_FILES['upload'] it was as below:
Array
(
[name] => picture.bmp
[type] =>
[tmp_name] =>
[error] => 1
[size] => 0
)
The code is:
if( is_uploaded_file( $_FILES['upload']['tmp_name'] ) )
{
// it does not reach here when it is bmp.
}
bmp file size is about 2.5MB and upload_max_filesize = 5M in PHP.ini
. I didn't have this issue before. Is there something here I'm doing wrong?
回答1:
Error 1 means:
The uploaded file exceeds the upload_max_filesize directive in php.ini.
Perhaps you edited the wrong php.ini
, or the directive is changed with an ini_set
later on. To be sure, do a phpinfo()
right before the upload processing code.
回答2:
See php upload error codes
As per php documentation
UPLOAD_ERR_INI_SIZE
Value: 1; The uploaded file exceeds the upload_max_filesize directive in php.ini.
来源:https://stackoverflow.com/questions/11310405/is-uploaded-file-blanks-picture-file-when-it-is-bmp-why