Yii 1.1: efineuploader

EFineUploader: Uploading files using ajax (without flash)

Uploading files using ajax (without flash).
Based on https://github.com/Widen/fine-uploader


  • Extract the release file under protected/extensions/EFineUploader


  • Yii 1.1 or above



                          'endpoint'=>'/files/upload',// OR $this->createUrl('files/upload'),
                                        //'onComplete'=>"js:function(id, name, response){  }",
                                        //'onError'=>"js:function(id, name, errorReason){ }",
                                 'sizeLimit'=>2 * 1024 * 1024,//maximum file size in bytes
                                 'minSizeLimit'=>2*1024*1024,// minimum file size in bytes


public function actionUpload()
                mkdir($tempFolder, 0777, TRUE);
                mkdir($tempFolder.'chunks', 0777, TRUE);
                $uploader = new qqFileUploader();
                $uploader->allowedExtensions = array('jpg','jpeg');
                $uploader->sizeLimit = 2 * 1024 * 1024;//maximum file size in bytes
                $uploader->chunksFolder = $tempFolder.'chunks';
                $result = $uploader->handleUpload($tempFolder);
                $result['filename'] = $uploader->getUploadName();
                $result['folder'] = $webFolder;
                header("Content-Type: text/plain");
                $result=htmlspecialchars(json_encode($result), ENT_NOQUOTES);
                echo $result;


Total 16 comments

#17392 report it
Trejder at 2014/06/03 05:20am
FineUploader licensing

Keep in mind, that even though FineUploader (which stands behind this extension) is open source, it still require you to pay license fee, if you're going to use it in a commercial product!

Here is a cite from FineUploader FAQ:

The intent of our licensing model is to make Fine Uploader freely accessible to free open-source projects, while collecting money from commercial users. We put a good amount of time, resources, and money into this project, and the financial sustainability of the library is important in order for us to continue to provide quick support, new features, and maintenance. There are even more reasons for purchasing a license on our homepage.

So, think twice, before you start using this extension in any non-free project or you may quickly run into some serious licensing issues!

#17389 report it
Trejder at 2014/06/02 09:26am
Lots of errors and mistakes in demo

As Patrice pointed out, demo & examples to this extension has a lot of errors, mistakes and bugs.

In particular:

  • define onValidateBatch event in your view (widget configuration) or jQuery script will fail,
  • remove $config['params']=$postParams line from the controller, $postParams is undefined,
  • remove $uploadedFile = $tempFolder.$result['filename']; line from the controller, it is useless,
  • change $result['folder'] to read dirname($result['filename']), cause in current example it attempts to read a non existing variable,
  • finally, change first three lines of your endpoint action to something like that:
$tempFolder = Yii::getPathOfAlias('webroot').'/temp';
if(!file_exists($tempFolder) && !is_dir($tempFolder)) mkdir($tempFolder, 0777, TRUE);
if(!file_exists($tempFolder.'/chunks') && !is_dir($tempFolder.'/chunks')) mkdir($tempFolder.'/chunks', 0777, TRUE);

or else your code will fail on attempting to create already existing folder. Alternatively you can add something like that:


to somewhere above Yii::app()->end(); to remove temp folders yourself. But, in this case, you should of course move uploaded file out of this folder to some destination.

#16516 report it
jcagentzero at 2014/03/01 09:51am
Great and working extension.

Thanks for the template, I was able to redesign the upload button and its label.

#16458 report it
jcagentzero at 2014/02/25 10:35pm
Great Extension!

it is working, but is there any way to configure the button and label easily?

#16220 report it
Patrice at 2014/01/30 04:54pm

Works fine :

1) in the controller, I commented the line

// $config['params']=$postParams;

2) in the view, I added these lines :

  'onComplete'=>"js:function(id, name, response){ // for test purpose
     alert(id + '/' + name + '/' + response.success + '/' + response.folder + '/' + response.filename);
   //'onError'=>"js:function(id, name, errorReason){ }",
  'onValidateBatch' => "js:function(fileOrBlobData) {}", // because of crash

and this one at the end of the view (just to make sure the uploaded filename is readable)

<div id="efine_name"></div>
#16184 report it
Prince Lonappan at 2014/01/27 01:56am
Edit uploaded file names


Currently am using this extension.Its great extension for me. There is an option for edit the uploaded filenames in the "fineuploader" plugin. So how to integrate this functionality in our EFineUploader extensions ?.

I have tried with "editFilename: { enabled: true } " this code.But nothing happens.

Please help me. Thanks,

#15598 report it
mostofa62 at 2013/11/27 12:01pm
nothing happend...

hello,i face the same problem, nothing is happened ,when i add a file , but its previous extension eajaxupload show the upload file details means,size,but failed i am in stuck both of your extension.... please help me out.

#14621 report it
Giancarlo at 2013/08/29 09:26am
no method 'onValidateBatch'

I have try your sample but i got this problem:

1) Line 117 commented // $config['params']=$postParams; 2)commented // mkdir($tempFolder, 0777, TRUE); // mkdir($tempFolder.'chunks', 0777, TRUE); because PHP warning mkdir(): File exists 3) commented // $result['folder'] = $webFolder; because PHP notice Undefined variable: webFolder 4) now, i see the component, but when i try to upload, i see nothing. Into debug console i see javascript error:

Uncaught TypeError: Object [object Array] has no method 'onValidateBatch' jquery.fineuploader-3.4.1.js:1452 qq.FineUploaderBasic._isBatchValid jquery.fineuploader-3.4.1.js:1452 qq.FineUploaderBasic._uploadFileOrBlobDataList jquery.fineuploader-3.4.1.js:1409 qq.FineUploaderBasic.addFiles jquery.fineuploader-3.4.1.js:1049 qq.FineUploaderBasic._onInputChange jquery.fineuploader-3.4.1.js:1340 qq.UploadButton.onChange jquery.fineuploader-3.4.1.js:1117 (anonymous function) jquery.fineuploader-3.4.1.js:680

can you help me?

#14346 report it
mtzmedia at 2013/08/05 03:57pm

Has anyone had success with the chunking feature? I've got it enabled as per the example, but it never posts the qqtotalparts or qqpartindex needed by the script. Any insights would be greatly appreciated!

#13722 report it
paskuale at 2013/06/19 04:06pm
show only <noscript>

Hi when I include your code in my view I have a blank page, If I try to read html (output) I see only :

Please enable JavaScript to use file uploader.

why ?

[solved] renderPartial issue :(

#13647 report it
minkbear at 2013/06/14 12:07am
Error: Undefined variable: postParams


I have the same problem. My solution is just comment code at the line 117 (Extension/EFineUploader/EFineUploader.php):


then it's work fine.

#13645 report it
yiiadict at 2013/06/13 01:53pm
hi kosenka..

hi @kosenka, i copy paste all your sample above, and i change folder path and myname controller, but when i load pages that sown error :

PHP notice
Undefined variable: postParams
117         $config['params']=$postParams;

help me please, thanks :d best regards.

#13007 report it
kosenka at 2013/04/27 02:24pm
They have different features.

1) About license: If you are afraid of license claims - please do not use this extension.
2) They have different features. Both have example PHP code, if I remember correctly.
3) You may have done something wrong. Please show me your source code.

#13000 report it
Trejder at 2013/04/27 05:33am
Two troubles

Provided example does not work at all! I've copied your code line-by-line, without any modifications and after clicking Upload a file, nothing happend. When I looked into console, I saw an error in line 1452 of jquery.fineuploader-3.4.1.js saying: Uncaught TypeError: Object [object Array] has no method 'onValidateBatch'.

You forgot to mention, that library behind your extension (Fine Uploader 3.4.1) is not free and requires a license for any kind of commercial use.

#12998 report it
Trejder at 2013/04/27 04:40am
Differences between EAjaxUploader and EFineUploader

Can you explain, in brief, what is key difference between EAjaxUploader and EFineUploader? Is the only difference, a different library behind? Or maybe new EFineUploader offers some features that EAjaxUploader lacks?

#12969 report it
Nur Rochim at 2013/04/24 10:03am

Great extension!

Leave a comment

Please to leave your comment.

Create extension