【问题标题】:PHP - GetImageSize()PHP-GetImageSize()
【发布时间】:2015-10-12 19:39:43
【问题描述】:

我正在尝试在图像上传脚本上使用getimagesize() 函数。 有时,在某些图像上,我得到一个错误。 所以我试图调查。

我使用了一个似乎可以工作的图像,用paint.exe对其进行了编辑,并将其保存为一个新的jpg图像。

当我查看$_FILES[] 时,我明白了:

原文:

$_FILES : array(2) {
  ["thumb_a_uploader"]=> array(5) {
    ["name"]=> string(8) "1212.jpg"
    ["type"]=> string(10) "image/jpeg"
    ["tmp_name"]=> string(14) "/tmp/phprZ2H8G"
    ["error"]=> int(0)
    ["size"]=> int(90281)
  }

已编辑:

$_FILES : array(2) {
  ["thumb_a_uploader"]=> array(5) {
    ["name"]=> string(16) "1212 - Copy.jpg"
    ["type"]=> string(0) ""
    ["tmp_name"]=> string(0) ""
    ["error"]=> int(2)
    ["size"]=> int(0)
  }

对于已编辑的,图像类型已被擦除。 我用智能手机拍摄的照片也有同样的问题。

有什么想法吗?

【问题讨论】:

  • 你得到error => 2这个错误是UPLOAD_ERR_FORM_SIZE Value: 2; The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form.

标签: php image file upload getimagesize


【解决方案1】:

您需要注意["error"]

["error"]=>
int(2)

 UPLOAD_ERR_FORM_SIZE

值:2;上传的文件超出了MAX_FILE_SIZE 指令 在 HTML 表单中指定。

了解更多关于php file-upload.errors

【讨论】:

  • 在我的 phpinfo() 我有这个 -> post_max_size 64M 我试过了: 它不起作用:(
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2011-01-26
  • 2012-09-26
  • 1970-01-01
  • 2012-05-06
  • 1970-01-01
  • 2020-04-25
  • 2011-06-05
相关资源
最近更新 更多