is_uploaded_file() blanks picture file when it is .bmp, why?

北城余情 提交于 2019-12-20 06:41:36

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!