Upload Image And Save It In My Images Folder

Hi All,

Good Morning,

i have one question regarding my student module.

i am uploading my student photo when i am creating student profile. and save that photo in my images folder.

file upload code is works properly…but not save in my folder…

here is my code…

kindly suggest proper solution.

When i am inserting data after that it gives me an error like:

Call to a member function saveAs() on a non-object in /var/www/demo/protected/controllers/StudentController.php

here is my action: student_photo is my field of student table.

    public function actionCreate()


	 $model=new Student;





		$model->dob = date("Y-m-d", strtotime($model->dob));




		$ext = pathinfo($image, PATHINFO_EXTENSION);

		$rnd = rand(0,9999);

		$fileName = "{$rnd}-".$ext;


		if($model->save(false)) {				









Thanks in Advance,

With Regards,


Remove the line:


and try again. Also you got the */ in


Hello BizleySir,

Thanks Sir,

its working…path is not proper set…now its working…

Thank u again.