I try ti user eajaxupload extention in yii(using this article: http://www.yiiframework.com/extension/eajaxupload
I want Upload and attache image to one of controller, I try this code: in controller: *(my controller name is : article)*
public function actionUpload()
{
Yii::import("ext.EAjaxUpload.qqFileUploader");
$folder= Yii::app()->baseUrl .'/uploads';// 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->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
}
and in _form.php (for controller) i have:
$this->widget('ext.EAjaxUpload.EAjaxUpload',
array(
'id'=>'uploadFile',
'config'=>array(
'action'=>'/article/upload',
'allowedExtensions'=>array("jpg"),//array("jpg","jpeg","gif","exe","mov" and etc...
'sizeLimit'=>10*1024*1024,// maximum file size in bytes
//'minSizeLimit'=>10*1024*1024,// minimum file size in bytes
//'onComplete'=>"js:function(id, fileName, responseJSON){ alert(fileName); }",
'showMessage'=>"js:function(message){ alert(message); }"
)
)); ?>
upload folder have full access for all!, but when i push upload file and select a file always get error: filename, filesize and Faild!
What is wrong in my code?