public function actionUpload()
    {
        /**
         * @var \kato\modules\media\Media $module
         */
        $module = \Yii::$app->controller->module;
        $result = $module->mediaUpload();

        $response = new Response();
        $response->format = Response::FORMAT_JSON;
        $response->setStatusCode(500);

        if ($result['success'] === true) {

            if ($this->doMediaJoin($result)) {
                //success
                $response->setStatusCode(200);
                $response->data = $result['data'];
                $response->send();
                Yii::$app->end();
            } else {
                $response->statusText = 'Unable to do join of media with content.';
                $response->send();
                Yii::$app->end();
            }

        } else {
            $response->statusText = $result['message'];
            $response->send();
            Yii::$app->end();
        }
    }
public function actionUpload()
    {
        /**
         * @var \kato\modules\media\Media $module
         */
        $module = \Yii::$app->controller->module;
        $result = $module->mediaUpload();

        $response = new Response();
        $response->format = Response::FORMAT_JSON;
        $response->setStatusCode(500);

        if ($result['success'] === true) {

            if ($this->doMediaJoin($result)) {
                //success
                $response->setStatusCode(200);
                $response->data = $result['data'];
                $response->send();
                Yii::$app->end();
            } else {
                $response->statusText = 'Unable to do join of media with content.';
                $response->send();
                Yii::$app->end();
            }

        } else {
            $response->statusText = $result['message'];
            $response->send();
            Yii::$app->end();
        }
    }
public function actionUpload ( ) { /**
         * @var \kato\modules\media\Media $module
         */ $ module = \ Yii :: $ app -> controller -> module ; $ result = $ module -> mediaUpload ( ) ; $ response = new Response ( ) ; $ response -> format = Response :: FORMAT_JSON ; $ response -> setStatusCode ( 500 ) ; if ( $ result [ 'success' ] === true ) { if ( $ this -> doMediaJoin ( $ result ) ) { //success $ response -> setStatusCode ( 200 ) ; $ response -> data = $ result [ 'data' ] ; $ response -> send ( ) ; Yii :: $ app -> end ( ) ; } else { $ response -> statusText = 'Unable to do join of media with content.' ; $ response -> send ( ) ; Yii :: $ app -> end ( ) ; } } else { $ response -> statusText = $ result [ 'message' ] ; $ response -> send ( ) ; Yii :: $ app -> end ( ) ; } }
Uploads the file and update database
Uploads the file and update database