php文件上传图像规格的最大尺寸

时间:2014-11-19 05:35:51

标签: php

该值应该是什么而不是2000 ...用于上传5mb文件?

   if ((($_FILES["upload"]["type"] == "image/gif")
    || ($_FILES["upload"]["type"] == "image/jpeg")
    || ($_FILES["upload"]["type"] == "image/jpg")
    || ($_FILES["upload"]["type"] == "image/pjpeg")
    || ($_FILES["upload"]["type"] == "image/x-png")
    || ($_FILES["upload"]["type"] == "image/png"))
    && ($_FILES["upload"]["size"] < 200000000)
    && in_array($extension, $allowedExts)) {
      if ($_FILES["upload"]["error"] > 0) {
        echo "Return Code: " . $_FILES["upload"]["error"] . "<br>";
      } else {
        echo "Upload: " . $_FILES["upload"]["name"] . "<br>";
        echo "Type: " . $_FILES["upload"]["type"] . "<br>";
        echo "Size: " . ($_FILES["upload"]["size"] / 1024) . " kB<br>";
        echo "Temp file: " . $_FILES["upload"]["tmp_name"] . "<br>";

2 个答案:

答案 0 :(得分:1)

5MB使用此:

5242880

5MB = 5242880 Bytes

以来

(快速谷歌搜索或大脑计算:D)

答案 1 :(得分:1)

您可以将 5242880 用于5MB。您可以使用此网站进行转换。 http://www.onlineconversion.com/computer_base2.htm