zxbodya / yii2-gallery-manager

93 stars 61 forks source link

500 Internal Server Error when I click add #46

Open Sabirgojayev opened 7 years ago

Sabirgojayev commented 7 years ago

It returns 500 Internal Server Error when I try to add an image. The error is : Call to a member function addImage() on null

  1. in C:\OpenServer\domains\azreal.az\vendor\zxbodya\yii2-gallery-manager\GalleryManagerAction.php at line 111 102103104105106107108109110111112113114115116117118119120 *

    • @return string
    • @throws HttpException */ public function actionAjaxUpload() {

      $imageFile = UploadedFile::getInstanceByName('image'); $fileName = $imageFile->tempName; $image = $this->behavior->addImage($fileName);

      // not "application/json", because IE8 trying to save response as a file

      Yii::$app->response->headers->set('Content-Type', 'text/html');

      return Json::encode( array( 'id' => $image->id, 'rank' => $image->rank,