duanrenchuo9244 2016-09-21 19:09
浏览 244
已采纳

php图片上传文件大小限制?

I have an image upload form for a client that I am having an issue with. I wish to set the file size to a maximum of 5.1 mb. However everything over 2.0 mb fails my if statement. below is the portion of the code I am using to qualify the file size. Are there limits to file size handlers that I am not aware of or does anyone see anything wrong with this expression? I am sure the expression is correct, as it works perfectly fine for images under 2mb. Thanks in advance.

if (($_FILES["file"]["size"][$i] < 5100000)     
                && in_array($file_extension, $validextensions)) 
  • 写回答

1条回答 默认 最新

  • dpfps86064 2016-09-21 19:21
    关注

    Did you check your php.ini? The default upload_max_filesize is 2MB.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?