public function actions() { return ['upload' => ['class' => \xj\ueditor\actions\Upload::className(), 'uploadBasePath' => Yii::$app->basePath . '/' . Yii::$app->params['uploadPath'] . '/', 'uploadBaseUrl' => '/doc/upload/', 'csrf' => true, 'configPatch' => ['imageMaxSize' => 500 * 1024, 'scrawlMaxSize' => 500 * 1024, 'catcherMaxSize' => 500 * 1024, 'videoMaxSize' => 1024 * 1024, 'fileMaxSize' => 1024 * 1024, 'imageManagerListPath' => '/', 'fileManagerListPath' => '/'], 'pathFormat' => ['imagePathFormat' => 'image/{yyyy}{mm}{dd}/{time}{rand:6}', 'scrawlPathFormat' => 'image/{yyyy}{mm}{dd}/{time}{rand:6}', 'snapscreenPathFormat' => 'image/{yyyy}{mm}{dd}/{time}{rand:6}', 'snapscreenPathFormat' => 'image/{yyyy}{mm}{dd}/{time}{rand:6}', 'catcherPathFormat' => 'image/{yyyy}{mm}{dd}/{time}{rand:6}', 'videoPathFormat' => 'video/{yyyy}{mm}{dd}/{time}{rand:6}', 'filePathFormat' => 'file/{yyyy}{mm}{dd}/{time}{rand:6}'], 'pathFormat' => ['imagePathFormat' => [$this, 'format'], 'scrawlPathFormat' => [$this, 'format'], 'snapscreenPathFormat' => [$this, 'format'], 'snapscreenPathFormat' => [$this, 'format'], 'catcherPathFormat' => [$this, 'format'], 'videoPathFormat' => [$this, 'format'], 'filePathFormat' => [$this, 'format']], 'beforeUpload' => function ($action) { // throw new \yii\base\Exception('error message'); //break }, 'afterUpload' => function ($action) { /* @var $action \xj\ueditor\actions\Upload */ //var_dump($action->result); // 'state' => string 'SUCCESS' (length=7) // 'url' => string '/attachment/201109/1425310269294251.jpg' (length=61) // 'relativePath' => string '201109/1425310269294251.jpg' () // 'title' => string '1425310269294251.jpg' (length=20) // 'original' => string 'Chrysanthemum.jpg' (length=17) // 'type' => string '.jpg' (length=4) // 'size' => int 879394 //throw new \yii\base\Exception('error message'); //break }]]; }
public function actions() { return ['upload' => ['class' => \xj\ueditor\actions\Upload::className(), 'uploadBasePath' => '@webroot/uploads', 'uploadBaseUrl' => '/uploads', 'csrf' => true, 'configPatch' => ['imageMaxSize' => 2000 * 1024, 'scrawlMaxSize' => 500 * 1024, 'catcherMaxSize' => 500 * 1024, 'videoMaxSize' => 5 * 1024 * 1024, 'fileMaxSize' => 1024 * 1024, 'imageManagerListPath' => '/', 'fileManagerListPath' => '/'], 'pathFormat' => ['imagePathFormat' => 'image/{yyyy}{mm}{dd}/{time}{rand:6}', 'scrawlPathFormat' => 'image/{yyyy}{mm}{dd}/{time}{rand:6}', 'snapscreenPathFormat' => 'image/{yyyy}{mm}{dd}/{time}{rand:6}', 'snapscreenPathFormat' => 'image/{yyyy}{mm}{dd}/{time}{rand:6}', 'catcherPathFormat' => 'image/{yyyy}{mm}{dd}/{time}{rand:6}', 'videoPathFormat' => 'video/{yyyy}{mm}{dd}/{time}{rand:6}', 'filePathFormat' => 'file/{yyyy}{mm}{dd}/{time}{rand:6}']]]; }