uploadmultifiles This is an extension used to upload multiple files at a time with multiple extensions

  1. Requirements
  2. Usage

...overview of the extension... Using this extension you can upload multiple files at a single time which can also contain multiple extensions.


...requirements of using this extension (e.g. Yii 1.1 or above)...


...how to use this extension... 1.Extract this extension into your protected/extensions folder.. 2.In Your Main.php Copy This Code...


3.In your View page..

               'allowedExtensions'=>array("jpg","jpeg","gif","exe","mov","mp4","txt","doc","pdf","xls","3gp","php","ini","avi","rar","zip","png"),//array("jpg","jpeg","gif","exe","mov" and etc...
               'sizeLimit'=>1000*1024*1024,// maximum file size in bytes
			   'multiple' => true,
			   'onComplete'=>"js:function(id, fileName, responseJSON){ alert(fileName); }",
                                 'typeError'=>"{file} has invalid extension. Only {extensions} are allowed.",
                                'sizeError'=>"{file} is too large, maximum file size is {sizeLimit}.",
                                'minSizeError'=>"{file} is too small, minimum file size is {minSizeLimit}.",
                                'emptyError'=>"{file} is empty, please select files again without it.",
                                'onLeave'=>"The files are being uploaded, if you leave now the upload will be cancelled."
               'showMessage'=>"js:function(message){ alert(message); }"

4.In Your Controller

public function actionUpload()
        $folder=Yii::getPathOfAlias('webroot').'/upload/';// folder for uploaded files
        $allowedExtensions = array("jpg","jpeg","gif","exe","mov","mp4");//array("jpg","jpeg","gif","exe","mov" and etc...
        $sizeLimit = 100 * 1024 * 1024;// maximum file size in bytes
        $uploader = new qqFileUploader($allowedExtensions, $sizeLimit);
        $result = $uploader->handleUpload($folder);
        $return = htmlspecialchars(json_encode($result), ENT_NOQUOTES);
        $fileSize=filesize($folder.$result['filename']);//GETTING FILE SIZE
        $fileName=$result['filename'];//GETTING FILE NAME
		//$img = CUploadedFile::getInstance($model,'image');
        echo $return;// it's array

5.This will work like charm. 6.If u need to add or choose the size of ur upload and download just change in the view widget.

Enojy file uploading

1 1
2 904 downloads
Yii Version: 1.1
License: BSD-2-Clause
Category: File System
Developed by: Manoj M
Created on: Dec 4, 2012
Last updated: 8 years ago


show all

Related Extensions