ferguson / yii2-upload
upload a file from local to remote server, a widget based on yii2.
Installs: 1
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Language:JavaScript
Type:yii2-extension
Requires
- ferguson/yii2-base: *
- yiisoft/yii2: ^2.0
This package is not auto-updated.
Last update: 2024-04-16 10:26:17 UTC
README
This is a uploaded library with plupload used to upload file.
NOTE: This extension depends on the yiisoft/yii2 extension. Check the composer.json for this extension's requirements and dependencies. PHP environment require
fileinfo
, if upload files is a imageimagick
orgd
required.imagick
is recommend and be priority of use
Why this extension
To ensure upload large files on most browsers, but in addition to plupload, all other plug-ins in use there is a little problem, such as uploadify
Installation
The preferred way to install this extension is through composer.
Note: Read this web tip /wiki on setting the
minimum-stability
settings for your application's composer.json.
Either run
$ php composer.phar require ferguson/yii2-upload "dev-master"
or add
"ferguson/yii2-upload": "dev-master"
to the require
section of your composer.json
file.
Usage
Once the extension is installed, simply modify your application configuration as follows:
return [ 'modules' => [ 'upload' => [ 'class' => \ferguson\upload\Module::className(), 'storage' => 'file', // which storage used, default `file` means file will be upload on server. other storages could be supported soon. 'params' => [ 'dir' => '@webroot', // file upload directory, default `@webroot`, you can customer. 'url' => '@web', // file uploaded host, default `@web`, you can customer. 'resize' => [ 'width' => '90', 'height' => '120', ], // thumb images size. 'watermark' => [ 'type' => ['font', 'image'], //null|string|array, which water type, single or both or none. 'position' => '', //font water setting. 'font' => [ 'ttf' => '', 'text' => '',//string, water text. 'size' => '10',// font size, default 10px ], //image water setting. 'image' => [ 'src' => '', //string, water image path, absolute path. 'size' => '' ], ], ], ], //... ], //... ];
use in view pages.
use ferguson\upload\Upload; //Normal with ActiveForm & model echo $form->field($model, 'logo')->widget(Upload::className(), [ 'clientOptions' => [ 'type' => Upload::TYPE_IMAGE, 'max_size' => '2mb', ] ]);
License
yii2-upload is released under the MIT License. See the bundled LICENSE.md
for details.