Please i need help with this extension! i followed all the instructions but it still gives me "failed"!!
here my code:
controller:public function actionUpload()
{
Yii::import("ext.EAjaxUpload.qqFileUploader");
$folder='C:/wamp/www/FinalProject/protected/views/tblTravelapplication/upload/';// folder for uploaded files
$allowedExtensions = array("jpg","gif","exe","pdf","doc","docx");//array("jpg","jpeg","gif","exe","mov" and etc...
$sizeLimit = 10 * 1024 * 1024;// maximum file size in bytes
$uploader = new qqFileUploader($allowedExtensions, $sizeLimit);
$result = $uploader->handleUpload($folder);
if(isset($result['success']))
if($result['success']==true)
{
$fileSize=filesize($folder.$result['filename']);//GETTING FILE SIZE
$fileName=$result['filename'];//GETTING FILE NAME
$mimetype=$fileName['mime'];
}
$return=htmlspecialchars(json_encode($result), ENT_NOQUOTES);
echo $return;// it's array
}
view:
<?php $this->widget(‘ext.EAjaxUpload.EAjaxUpload’,
array(
'id'=>'uploadFile',
'config'=>array(
'action'=>Yii::app()->baseUrl.'/index.php?r=tblTravelapplication/upload',
'allowedExtensions'=>array("jpg","gif","exe","pdf","doc","docx"),//array("jpg","jpeg","gif","exe","mov" and etc...
'sizeLimit'=>10*1024*1024,// maximum file size in bytes
'minSizeLimit'=>1*100*100,// minimum file size in bytes
'multiple'=>false,
'onComplete'=>"js:function(id, fileName, responseJSON){ alert(fileName); }",
//'messages'=>array(
// '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.",
// ),
//'showMessage'=>"js:function(message){ alert(message); }"
)
)); ?>