hi
by using this linki tried to save an uploaded image but i got error:
here is my controller:
if(isset($_POST['Category']))
{
$uploadModel = new UploadForm;
$uploadModel->upload_file = CUploadedFile::getInstance($uploadModel,'image');
$uploadModel->upload_file->save("C:\\".$uploadModel->upload_file->name);
$model->attributes=$_POST['Category'];
if($model->save()){
$this->redirect(array('view','id'=>$model->category_id));
}
}
and added these lines to my view:
<div class="row">
<input type="file" name="image"/>
</div>
and here is the error msg:
Fatal error: Call to a member function save() on a non-object in C:\xampp\htdocs\sd\protected\controllers\CategoryController.php on line 57
thanks…