I am uploading a file using a fileField
form CActiveForm
and it works for 'small' files, but when I upload a larger file, the page just reloads with a blank form and nothing in either the $_POST
or $_FILES
variable.
My form has 'htmlOptions'=>array('enctype'=>'multipart/form-data'
and the post_max_size
and upload_max_filesize
are both set to 100M in php.ini
I'm using Yii 1.1.14 and PHP 5.5.12.
The file model, nothing special
class DocumentUploadModel extends CFormModel {
public $thefile;
public function rules () {
return array (
array ('thefile', 'file', 'types' => 'pdf'),
);
}
}
The filefield
, also nothing special
<div class="row">
<?php echo $form->labelEx($documentFile,'thefile'); ?>
<?php echo $form->fileField($documentFile,'thefile'); ?>
<?php echo $form->error($documentFile,'thefile'); ?>
</div>
Var dumps from small file, 344KB (top = $_POST, bottom is $_FILES
And the same for a larger file, 22.405K
I hope somebody can help me!
edit the validation rule to:
array ('thefile', 'file', 'types' => 'pdf', 'allowEmpty'=>false),
Change the file upload size limit as per your requirement in php.ini and apache config.