Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>that extension is outdated and poorly supported. I use this extension instead: <a href="http://www.yiiframework.com/extension/eajaxupload" rel="nofollow">eajaxupload</a>.</p> <p>As you can see on that page the usage is extremely simple. Upload it to your extensions dir and install it with these few lines of code</p> <p>First you put the following code in your controller action:</p> <pre><code>public function actionUpload() { Yii::import("ext.EAjaxUpload.qqFileUploader"); $folder='upload/';// folder for uploaded files $allowedExtensions = array("jpg");//array("jpg","jpeg","gif","exe","mov" and etc... $sizeLimit = 10 * 1024 * 1024;// maximum file size in bytes $uploader = new qqFileUploader($allowedExtensions, $sizeLimit); $result = $uploader-&gt;handleUpload($folder); $result=htmlspecialchars(json_encode($result), ENT_NOQUOTES); $fileSize=filesize($folder.$result['filename']);//GETTING FILE SIZE $fileName=$result['filename'];//GETTING FILE NAME echo $result;// it's array } </code></pre> <p>After that go to the associated view file for that action and use this code to generate the upload form:</p> <pre><code>&lt;? $this-&gt;widget('ext.EAjaxUpload.EAjaxUpload', array( 'id'=&gt;'uploadFile', 'config'=&gt;array( 'action'=&gt;'/controller/upload', 'allowedExtensions'=&gt;array("jpg");//array("jpg","jpeg","gif","exe","mov" and etc... 'sizeLimit'=&gt;10*1024*1024,// maximum file size in bytes 'minSizeLimit'=&gt;10*1024*1024,// minimum file size in bytes //'onComplete'=&gt;"js:function(id, fileName, responseJSON){ alert(fileName); }", //'messages'=&gt;array( // 'typeError'=&gt;"{file} has invalid extension. Only {extensions} are allowed.", // 'sizeError'=&gt;"{file} is too large, maximum file size is {sizeLimit}.", // 'minSizeError'=&gt;"{file} is too small, minimum file size is {minSizeLimit}.", // 'emptyError'=&gt;"{file} is empty, please select files again without it.", // 'onLeave'=&gt;"The files are being uploaded, if you leave now the upload will be cancelled." // ), //'showMessage'=&gt;"js:function(message){ alert(message); }" ) )); ?&gt; </code></pre> <p>Extremely easy to get working. Give it a go!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload