How to upload file more than 2Mb

Hi,

I’m working on a project which allows the user to upload files and saves it to a MySql database. It works perfectly for files up to 2Mb. However, I want to increase the file upload limit. How do I do this?

Here are some snippets on how I did file uploading:

_form.php:





<?php $form=$this->beginWidget('CActiveForm', array(

	'id'=>'form-id',

	'enableAjaxValidation'=>false,

	'htmlOptions'=>array('enctype'=>'multipart/form-data'),

)); ?>

	

	<?php echo $form->errorSummary($model); ?>

	<div class="row">

		<?php echo $form->fileField($model,'uploadedFile'); ?>

		<?php echo $form->error($model,'uploadedFile'); ?>

	</div><br />


        ...




model:




public function beforeSave(){

		//set the encryption key

		$securityManager =  new CSecurityManager;

		$securityManager->setEncryptionKey(Yii::app()->params['fileEncryptKey']);		

		

		if($file=CUploadedFile::getInstance($this,'uploadedFile')){

			$this->fileName = $file->name;

			$this->fileType = $file->type;

			$this->fileSize = $file->size;		

			$this->fileContent = $securityManager->encrypt(base64_encode(file_get_contents($file->tempName)));			

		}

		

		

		return parent::beforeSave();

	}



I think it has no relation with Yii, it´s the PHP default limit in most installations.

You have to edit your php.ini and change:

upload_max_filesize

and

post_max_size

I figured. Works fine now. Thanks!