Hi Everyone!!!
Good Morning to all of you…
I am using CMultiFileUpload to upload a file in which I am facing an issue.
Please look below code :
$this->widget('CMultiFileUpload', array(
'name' => 'imagepath',
'id'=>'imagepath',
'duplicate' => 'Duplicate file!', // useful, i think
'denied' => 'Invalid file type', // useful, i think
'options' =>array(
'afterFileSelect'=>'function(e ,v ,m){
var fileSize = e.files[0].size;
if(fileSize>2*1024*1024){
alert("Exceeds file upload limit 2MB");
$(".MultiFile-remove").click();
}
return true;
}',
),
));
In this code, I have put a validation that user can not upload a file whose size is more than 2mb.
It is working fine. But the problem is that, when I select multiple files for uploading one by one. At last,If I select a file which is greater than 2mb, it will throw an error and discard all previous files also along with new one. Actually the behavior should be like only discard the new one file which is greater than 2mb.
Seeking for your Reply…
Thanks!!!