/**
  * Creates a new ProductPictures model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new ProductPictures();
     $model->setScenario(ProductPictures::SCENARIO_CREATE);
     if ($model->load(Yii::$app->request->post())) {
         $model->imageFile = UploadedFile::getInstance($model, 'imageFile');
         $model->file = $model->imageFile->baseName . '.' . $model->imageFile->extension;
         if ($model->save() && $model->upload()) {
             \Yii::$app->getSession()->setFlash('success', 'Picture was uploaded and saved.');
         } else {
             \Yii::$app->getSession()->setFlash('error', 'Picture was not uploaded.');
         }
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }