PHP code example of liyifei / yii2-pluploader

1. Go to this page and download the library: Download liyifei/yii2-pluploader library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

liyifei / yii2-pluploader example snippets


<?=\liyifei\pluploader\PlUploaderWidget::widget([
                                                    'uploadto' => '/weixin/upload',
                                                    'fileSizeLimit' => "512k",
                                                    'fileNumLimit' => 1,
                                                    'fileExtLimit' => 'jpg,jpeg,png',
                                                    'formData' => array('a' => 'b', 'c' => 'd'),
                                                    'callback' => 'uploadsingle'
                                                  ]); 

public function actions()
{
    return [
        'uploadlocal'=>[
            'class'=> PlUploaderAction::className(),
            'fileExtLimit' => 'jpg,jpeg,png',
            'fileSizeLimit' => 512 * 1024,
            'uploader'=>new LocalUploader(),
            'uploadDir' => Yii::getAlias('@storage') . '/upload',
            'uploadUrl' => 'http://fanlis.localhost.com/upload',
            'allowAnony' => true,
            'renameFile' => true
        ],
        'uploadqiniu'=>[
            'class'=> PlUploaderAction::className(),
            'fileExtLimit' => 'jpg,jpeg,png',
            'fileSizeLimit' => 512 * 1024,
            'uploader'=>new QiniuUploader(['bucket'=>'','accesskey'=>'','secretkey'=>'']),
            'uploadDir' => '/',
            'uploadUrl' => 'http://asdf.qiniudn.com/',
            'allowAnony' => true,
            'renameFile' => true
        ]
    ];
}


php composer.phar