2016-09-21 19:09
浏览 229


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)) 

图片转代码服务由CSDN问答提供 功能建议

我有一个客户的图片上传表格,我遇到了问题。 我希望将文件大小设置为最大5.1 MB。 但是,超过2.0 MB的所有内容都无法使用if语句。 下面是我用来限定文件大小的代码部分。 我不知道文件大小处理程序是否有限制,或者有没有人看到这个表达式有什么问题? 我确信表达式是正确的,因为它适用于2mb以下的图像。 提前致谢。

  if(($ _FILES [“file”] [“size”] [$ i]&lt; 5100000)
&amp;&amp; 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.

    打赏 评论

相关推荐 更多相似问题