Image Uploading Problem

Hi all :),

I am trying to write an upload-image code.

I created an Image CActiveRecord model (and created a db table too…)

Now, I want to upload image from other controller. lets say from my userController.

I write this code in the actionCreate function:

	public function actionCreate()


		$model=new User;





			$model->image = Image::upload($uploadedFile)->id;








And I have this Image::upload function:

	public static function upload($uploadedFile)


		$image = new Image();

		$image->code = md5(microtime().rand(1,9999).$uploadedFile->name);

		$image->size = $uploadedFile->size;

		$image->type = $uploadedFile->type;

		$image->suffix = ".".$uploadedFile->getExtensionName();




			return $image;


		return false;


And of course, I added a CHtml::activeFileField in my form…

What is wrong?


Never mind. I’ve solved it. thanks