I have model which handle my file uploading. everything ok.
but when it run the save() method, in the datebase insert 2 record and then insert my uploaded file name record.
what is the problem?![:unsure:]()
this is my controller action:
but when it run the save() method, in the datebase insert 2 record and then insert my uploaded file name record.
what is the problem?

this is my controller action:
public function actionCreate() { $model = new Picture; if (isset($_POST['Picture'])) { $rnd = rand(0, 9999); $model->attributes = $_POST['Picture']; $uploadFile = CUploadedFile::getInstance($model, 'address'); $model->address = "{$rnd}-{$uploadFile}"; if ($model->save()) { $uploadFile->saveAs(Yii::app()->basePath . '/../upload/' . "{$rnd}-{$uploadFile}"); //$this->redirect(array('view', 'id' => $model->id)); } } $this->render('create', array('model' => $model, )); }