2017 © Pedro Peláez
 

yii2-extension yii2-upload

upload a file from local to remote server, a widget based on yii2.

image

ferguson/yii2-upload

upload a file from local to remote server, a widget based on yii2.

  • Friday, April 7, 2017
  • by ferguson
  • Repository
  • 1 Watchers
  • 0 Stars
  • 53 Installations
  • JavaScript
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 20 % Grown

The README.md

Yii2-upload

This is a uploaded library with plupload used to upload file., (*1)

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 image imagick or gd required. imagick is recommend and be priority of use, (*2)

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, (*3)

Installation

The preferred way to install this extension is through composer., (*4)

Note: Read this web tip /wiki on setting the minimum-stability settings for your application's composer.json., (*5)

Either run, (*6)

$ php composer.phar require ferguson/yii2-upload "dev-master"

or add, (*7)

"ferguson/yii2-upload": "dev-master"

to the require section of your composer.json file., (*8)

Usage

Once the extension is installed, simply modify your application configuration as follows:, (*9)

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., (*10)

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., (*11)

The Versions

07/04 2017

dev-master

9999999-dev https://git.mlfh.info/ferguson/yii2-plupload

upload a file from local to remote server, a widget based on yii2.

  Sources   Download

MIT

The Requires

 

by Avatar ferguson

file jquery upload widget input html5 plupload