私は yii で ti ユーザーの eajaxupload エクステンションを試します (この記事を使用: http://www.yiiframework.com/extension/eajaxupload
コントローラーの1つに画像をアップロードして添付したい、私はこのコードを試します: コントローラー内: * (私のコントローラー名は:記事) *
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
}
そして_form.php(コントローラー用)には次のものがあります:
$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); }"
)
)); ?>
アップロードフォルダーにはすべてのフルアクセスがあります!しかし、アップロードファイルをプッシュしてファイルを選択すると、常にエラーが発生します:ファイル名、ファイルサイズ、失敗!
私のコードで何が間違っていますか?