Hi,
I am getting a HTTP 400 error and for the life of me, I cannot figure out why?
The following code I am placing in my controllers/AdminController within my Company Module:
function init(){
if(isset($_POST['SESSION_ID'])) {
$session=Yii::app()->getSession();
$session->close();
$session->sessionID = $_POST['SESSION_ID'];
$session->open();
}
}
function actionUpload() {
$model=new Company;
if(isset($_POST['Company'])){
$model->logo=CUploadedFile::getInstance($model,'logo');
if(!$model->save()) throw new CHttpException(500);
$model->logo->saveAs('someFile.jpg');
Yii::app()->end();
}
echo 1;
}
Then I am using the following code within my _form.php page to create and update my company information:
$this->widget('MUploadify',array(
'model'=>$model,
'attribute'=>'logo',
'script'=>$this->createUrl('/company/admin/upload'),
'auto'=>true,
'onError' => 'js:function(evt,queueId,fileObj,errorObj){alert("Error: " + errorObj.type + "\nInfo: " + errorObj.info);}',
));
The callback onError gives me the type: HTTP Error, info: 400.
The "progress bar" also returns the message HTTP Error.
I have checked the log to make sure that it is using the correct path to my actionUpload method and it seems fine.
#4 {main} REQUEST_URI=/example.com/company/admin/upload
Which is the correct path! BUT I don’t think it is able to access my actionUpload function to process the request.
I have tried manually creating a text log file to see if the function is being called, but nothing is being created which leads me to believe that it is not being called.
Any ideas?
