Download the PHP package yii2-uploader/storage without Composer
On this page you can find all versions of the php package yii2-uploader/storage. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download yii2-uploader/storage
More information about yii2-uploader/storage
Files in yii2-uploader/storage
Package storage
Short Description This version is minify from yii2 kit file to remove unnecessary jquery, css ui in the api template\
License
Informations about the package storage
This kit is designed to automate routine processes of uploading files, their saving and storage. and motify from yii2-file-kit remove css, jquery remove unnecessary libraries running on rest
Here you can see list of available filesystem adapters
Installation
The preferred way to install this extension is through composer.
Either run
or add
to the require section of your composer.json
file.
File Storage
To work with the File Kit you need to configure FileStorage first. This component is a layer of abstraction over the filesystem
- Its main task to take on the generation of a unique name for each file and trigger corresponding events.
There are several ways to configure trntv\filekit\Storage
to work with flysystem
.
Using Closure
Using filesystem builder
- Create a builder class that implements
trntv\filekit\filesystem\FilesystemBuilderInterface
and implement methodbuild
which returns filesystem object. Seeexamples/
- Add to your configuration:
Read more about flysystem at http://flysystem.thephpleague.com/
Using third-party extensions
-
Create filesystem component (example uses
creocoder/yii2-flysystem
) - Set filesystem component name in storage configuration:
Actions
File Kit contains several Actions to work with uploads.
Upload Action
Designed to save the file uploaded by the widget
See additional settings in the corresponding class
Delete Action
See additional settings in the corresponding class
View (Download) Action
See additional settings in the corresponding class
Upload Widget
Standalone usage
Standalone usage - without model
With ActiveForm
Upload Widget events
Upload widget trigger some of built-in blueimp events:
- start
- fail
- done
- always
You can use them directly or add your custom handlers in options:
UploadBehavior
This behavior is designed to save uploaded files in the corresponding relation.
Somewhere in model:
For multiple files
For single file upload
See additional settings in the corresponding class.
Validation
There are two ways you can perform validation over uploads. On the client side validation is performed by Blueimp File Upload. Here is documentation about available options.
On the server side validation is performed by [[yii\web\UploadAction]], where you can configure validation rules for [[yii\base\DynamicModel]] that will be used in validation process
Tips
Adding watermark
Install intervention/image
library
Edit your upload actions as so