public function actionUpload($id) { Yii::$app->response->format = Response::FORMAT_JSON; $model = new GalleryPhoto(); $model->gallery_id = (int) $id; $model->saveUploadedFile(); // $bundle = FilemanagerAsset::register($this->view); if ($model->isImage()) { $model->createThumbs(); } $response['files'][] = ['url' => $model->url, 'thumbnailUrl' => $model->getDefaultThumbUrl(), 'name' => $model->filename, 'type' => $model->type, 'size' => $model->file->size, 'deleteUrl' => Url::to(['gallery-photo/delete', 'id' => $model->id]), 'deleteType' => 'POST']; return $response; }