is_uploaded_file() 当图片文件是.bmp 时,它是空白的,为什么? [英] is_uploaded_file() blanks picture file when it is .bmp, why?

查看:27
本文介绍了is_uploaded_file() 当图片文件是.bmp 时,它是空白的,为什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我上传任何文件时,一切看起来都不错.我在 pics 文件夹中有这些图片.未知部分是当我上传 bmp 文件时.我检查文件类型以查看它们是否为 jpg、gif 等.但代码无法到达那里.
我也回应了 $_FILES['upload'] 如下:

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
)

代码是:

if( is_uploaded_file( $_FILES['upload']['tmp_name'] ) ) 
{
       // it does not reach here when it is bmp.
}

PHP.ini 中的 bmp 文件大小约为 2.5MB,upload_max_filesize = 5M.我以前没有这个问题.是不是我做错了什么?

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 ​​表示:

上传的文件超过了 php.ini 中的 upload_max_filesize 指令.

The uploaded file exceeds the upload_max_filesize directive in php.ini.

也许您编辑了错误的 php.ini,或者稍后使用 ini_set 更改了指令.可以肯定的是,在上传处理代码之前执行 phpinfo().

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.

这篇关于is_uploaded_file() 当图片文件是.bmp 时,它是空白的,为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆