/** * Creates a new Multimedia model desde el OBJETO * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionSubir2($objeto_id) { $model = new Multimedia(); $model->objetos_id = $objeto_id; $m = $model->load(Yii::$app->request->post()); if ($m) { // process uploaded image file instance $image = $model->uploadImage(); if ($model->save()) { // upload only if valid uploaded file instance found if ($image !== false) { $path = $model->getImageFile(); $image->saveAs($path); } return $this->redirect(['index', 'id' => $model->id, 'tipoMultimedia_id' => $model->tipoMultimedia_id]); } } else { return $this->render('subir', ['model' => $model, 'objeto_id' => $objeto_id]); } /*if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['view', 'id' => $model->id, 'tipoMultimedia_id' => $model->tipoMultimedia_id]); } else { return $this->render('create', [ 'model' => $model, ]); }*/ }