【问题标题】:Yii + CuploadedFIle + POST Content-Length of X bytes exceeds the limit of Y bytes in Unknown on line 0Yii + CuploadedFIle + POST Content-Length of X bytes 超过第 0 行 Unknown 中 Y 字节的限制
【发布时间】:2012-10-14 15:15:00
【问题描述】:

如果我在验证规则中使用我的文件上传

array('taskfile', 'file', 'allowEmpty' => true, 'maxSize' => 1024 * 1024 * 1)

如果 maxSize

Warning: POST Content-Length of 41816263 bytes exceeds the limit of 15728640 bytes in Unknown on line 0

upload_max_filesize 和 post_max_size 在 php.ini 中设置。 我也用自己的验证规则尝试了这个解决方法,但它也不起作用。

 public function checkMaxFileSize($attribute) {
    $max_post_size = 1024 * 1024 * ini_get('post_max_size');
    $file_is_too_big = ($_SERVER['CONTENT_LENGTH'] > $max_post_size) ? true : false;

    if ($file_is_too_big)
        $this->addError($attribute, "too big");

如果 yii 未处于调试模式,也会显示错误。

【问题讨论】:

  • 尝试解决方案here

标签: php file-upload yii warnings max-size


【解决方案1】:

尝试在您的 .htaccess 文件中设置您的 post_max_size/upload_max_filesize

php_value post_max_size 10M
php_value upload_max_filesize 10M

【讨论】:

  • 不起作用。我也用字节而不是 M 尝试过。两者都不起作用。
猜你喜欢
  • 2020-12-04
  • 2012-07-29
  • 1970-01-01
  • 2013-06-20
  • 2017-03-12
  • 2011-09-10
  • 2016-08-21
  • 2022-06-14
相关资源
最近更新 更多