1. Go to this page and download the library: Download davidxu/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/ */
davidxu / yii2-pluploader example snippets
use davidxu\pluploader\PlUploader;
// without model
use \davidxu\pluploader\PlUploaderAction;
public function actions()
{
return [
'local'=>[
'class'=> PlUploaderAction::class,
'uploaderDriver' => 'local', // local, qiniu, oss, steam
'fileExtLimit' => 'jpg,jpeg,png',
'fileSizeLimit' => 512 * 1024,
'uploaderPath' => Yii::getAlias('@app/web/uploads'),
'uploadUrl' => 'http://host.local/uploads',
'allowAnony' => true,
'renameFile' => true,
'useDbIdForUrl' => true, // return file id in DB to image url instead of file url
],
];
}
use davidxu\pluploader\PlUploader;
// without model
use davidxu\pluploader\PlUploaderAction;
public function actions()
{
return [
// TODO, not completed yet
'qiniu'=>[
'class'=> PlUploaderAction::class,
'uploaderDriver' => 'qiniu',
'uploadDir' => '/',
'uploadUrl' => 'http://n1.qiniudn.com/',
'allowAnony' => true,
'renameFile' => true,
'callbackUrl' => '/callback/qiniu',
]
];
}
php composer.phar
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.