public function actionCreateID($id) { $model = new Pics(); $modelff = new FileForm(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['Pics'])) { $model->setAttributes($_POST['Pics']); $modelff->attributes = $_POST['FileForm']; $modelff->image = CUploadedFile::getInstance($modelff, 'image'); if ($model->save()) { if (is_object($modelff->image)) { $path = 'images/' . $modelff->image; $modelff->image->saveAs($path); } $this->redirect(array('view', 'id' => $model->id)); } } $this->render('create', array('model' => $model, 'ff' => $modelff, 'bbid' => $id)); }