Hello,
I’m currently working on an fileupload system powered with JUpload (http://jupload.sourceforge.net).
But when I try to save my filename to a session variabele, I get a 500 error in my trace log:
[php] Indirect modification of overloaded element of CHttpSession has no effect (filename)
this is my code:
public function actionProcessupload() { Yii::trace(strrev(dirname(__FILE__)), 't'); $basePath = strrev(strstr(substr(strstr(strrev(dirname(__FILE__)),DIRECTORY_SEPARATOR),1),DIRECTORY_SEPARATOR)); Yii::trace($basePath,'upload'); if(isset($_FILES)) { $session = new CHttpSession; $session['file'] = array(); foreach($_FILES as $file => $fileData) { $uploadedFile = CUploadedFile::getInstanceByName($file); if($uploadedFile === null) { Yii::trace('no file found', 'system.upload'); }else{ Yii::trace('file found', 'system.upload'); Yii::trace($uploadedFile->getName(). " ". $uploadedFile->getTempName()." ".$uploadedFile->getError(), 'system.upload'); if($uploadedFile->saveAs($basePath.DIRECTORY_SEPARATOR.Yii::app()->params['photoDir'].DIRECTORY_SEPARATOR.$uploadedFile->getName()) === true) { Yii::trace('Save successed','system'); array_push($session['file'],$uploadedFile->getName()); }else{ Yii::trace('Save failed', 'system'); } } } echo "SUCCESS"; } } [code] The exceptions comes from the line that does the array_push. anyone?
Session autostart is on in app config:
... 'components'=>array( 'session' => array( 'autoStart'=> true ) ..