Yii Cmultifileupload Max File Size Validation

I am using CMultifileUpload for the file upload and trying to set the Maximum upload size for the file. As I searched and didn’t get any in-built parameters to set the Max file size before upload.

Here my upload file code,


                $this->widget('CMultiFileUpload', array(


                    'name' => 'videofile', 


                    'accept' => $filetype,  

                    'duplicate' => 'Duplicate file!', 

                    'denied' => 'Invalid file type', 

                    'htmlOptions'=>array('style'=>'opacity: 0;  height: 136px; width: 200px;cursor: pointer;'),


                        'onFileSelect'=>'function(e, v, m){

    						var size=$("#videofile")[0].files[0].size;


    						if(size <=25*1024*1024){




    							alert("File Size Exceeded");


    							return false;






What i am getting is, the if condition success case is working fine, but for the failure case, the form is not reseting.

And what actually I am trying is, want to validate the file size before submitting.

Help me. Thanks in advance.

You can try this. this will work

'afterFileSelect'=>'function(e ,v ,m){

            var fileSize = e.files[0].size;

                 if(fileSize>800*1024){ <--800KB limit

                    alert("Exceeds file upload limit 800KB");

                    $(".MultiFile-remove").click(); <--cliks the remove button if size exceeds


                  return true;


This will remove all items, not only the erroneous one

write this instead

$(".MultiFile-remove").last().click()	;