-1

if i use in validation rule for my file to upload

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

if maxSize < file size < max_pos the correct error displays but if maxSize < max_post_size < file size then i receive no error messagre but a php warning at the top of my site.

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

upload_max_filesize and post_max_size are set in the php.ini. i also tried this workaround with an own vaildation rule, but it doesnt work either.

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

the error is also display if yii is not in debug mode.

Garry Cat
  • 31
  • 1
  • 8
  • 1
    try the solutions [here](http://stackoverflow.com/questions/2133652/how-to-gracefully-handle-files-that-exceed-phps-post-max-size) – bool.dev Oct 24 '12 at 14:51

1 Answers1

0

Try setting your post_max_size/upload_max_filesize in your .htaccess file

php_value post_max_size 10M
php_value upload_max_filesize 10M
Brett Gregson
  • 5,867
  • 3
  • 42
  • 60