Hallo guys, i have a little problem i hope someone will help me out
Fatal error: Call to a member function saveas() on a non-object in C:\wamp\www\writing\protected\controllers\OrdersController.php on line 77
i have tried to debug the code but i can’t seem to get where im going wrong.
public function actionCreate()
{
$model=new Orders;
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if(isset($_POST['Orders']))
{
$model->attributes=$_POST['Orders'];
$file = CUploadedFile::getInstance($model, 'attachment');
$model->attachment = $file;
if($model->save()){
$path = Yii::getPathOfAlias('webroot'). "/uploads/" .$model->attachment;
$file->saveas($path);
$this->redirect(array('view','id'=>$model->id));
}
}
$this->render('create',array(
'model'=>$model,
));
}
please help