xinyeweb/yii2-webuploader

yii2-webuploader

Installs: 61

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 3

Forks: 0

Open Issues: 0

Language:JavaScript

Type:yii2-extension

dev-master 2021-04-01 08:10 UTC

This package is auto-updated.

Last update: 2024-03-29 03:19:47 UTC


README

yii2-webuploader 組件。

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist xinyeweb/yii2-webuploader "dev-master"

or add

"xinyeweb/yii2-webuploader": "dev-master"

to the require section of your composer.json file.

Usage

單圖使用 :

<?= \xinyeweb\webuploader\WebUploader::className(); ?>

多圖使用 :

<?= 
    $form->field($model, 'pics')->widget(\xinyeweb\webuploader\WebUploader::className(),[
        'clientOptions' => [
            'pick' => [
                'multiple' => true,
            ],
        ]
    ]) ?>

Controller 中配置上傳 :

    public function actions() {
        return ArrayHelper::merge(parent::actions(), [
            'upload' => [
                'class' => '\xinyeweb\webuploader\WebUploaderAction',
            ],
        ]);
    }

高級版 上傳目錄

    Yii::setAlias('@upload', dirname(dirname(__DIR__)) . '/web/uploads'); //存储目录path

基礎版 上傳目錄 入口文件

    Yii::setAlias('@upload', __DIR__ . '/uploads'); //存储目录path