PHPackages                             davidxu/yii2-upload - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [File &amp; Storage](/categories/file-storage)
4. /
5. davidxu/yii2-upload

ActiveYii2-extension[File &amp; Storage](/categories/file-storage)

davidxu/yii2-upload
===================

A Yii2 Uploader with plupload

1.0.11(2y ago)049MITPHPPHP &gt;=7.1

Since Jun 30Pushed 2y agoCompare

[ Source](https://github.com/davidxuuts/yii2-upload)[ Packagist](https://packagist.org/packages/davidxu/yii2-upload)[ RSS](/packages/davidxu-yii2-upload/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (3)Versions (13)Used By (0)

A Yii2 Upload Widget
====================

[](#a-yii2-upload-widget)

This is a Yii2 upload widget with plupload, includes 'local' upload and 'qiniu' upload

Functions
---------

[](#functions)

By using this widget, you can upload files to local server or remote qiniu bucket directly

It also supports second upload function by used Qiniu [QETag](https://github.com/qiniu/qetag).

Chunk upload is also enabled. If custom `chunkSize` more than system size (`get_cfg_var('upload_max_filesize')`), system upload max filesize will be used

You can upload files to local server or [Qiniu Kodo](https://developer.qiniu.com/kodo) currently.

For more Qiniu Kodo policy please refer to Qiniu website.

We use custom function for video/image upload and insert.

If cache set, you can get uploaded file information by `Yii::$app->cache->get($info['path'])` and invalidate this key by using `yii\caching\TagDependency::invalidate($cache, $info['path'] . $info['hash'])`

Installation
------------

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
php composer.phar require --prefer-dist davidxu/yii2-upload "*"

```

or add

```
"davidxu/yii2-upload": "*"

```

to the requirement section of your `composer.json` file.

Usage
-----

[](#usage)

If you want to store files information in DB (MySQL/MariaDB), please execute migration file by

```
yii migrate/up @davidxu/base/migrations

```

and then simply use it in your code by:

### for Local upload

[](#for-local-upload)

---

##### In View

[](#in-view)

```
