Yii Framework Forum: آپلود عکس بدون استفاده از مدل - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

آپلود عکس بدون استفاده از مدل

#1 User is offline   desatir7316 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 78
  • Joined: 19-March 14

Posted 31 March 2014 - 03:59 AM

سلام دوستان
با استفاده از این لینک سعی کردم بدون استفاده از مدل(نمی خوام تو دیتابیس ذخیره شه) عکس رو آپلود کنم ولی خطا داد

controller:
public function actionCreate()
	{
		$model=new Category;

		// Uncomment the following line if AJAX validation is needed
		// $this->performAjaxValidation($model);

		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));
         }
		}

		$this->render('create',array(
			'model'=>$model,
		));
	}

0

#2 User is offline   desatir7316 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 78
  • Joined: 19-March 14

Posted 31 March 2014 - 04:26 AM

درست شد
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users