2017 © Pedro Peláez
 

yii2-extension yii2-flowjs

Easy to use widget and controller for adding HTML5 fully customizable file upload to your app

image

leammas/yii2-flowjs

Easy to use widget and controller for adding HTML5 fully customizable file upload to your app

  • Sunday, November 15, 2015
  • by leammas
  • Repository
  • 2 Watchers
  • 1 Stars
  • 915 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Yii2 FlowJs Extension

Easy to use widget and controller for adding HTML5 fully customizable file upload to your app, (*1)

Installation

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

Either run, (*3)

php composer.phar require --prefer-dist leammas/yii2-flowjs "*"

or add, (*4)

"leammas/yii2-flowjs": "*"

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

Usage

Widget

Add the widget with corresponding settings in your view. For more insight about settings and restrictions @see FlowJsWidget.php. Don't forget to add target setting containing url to FlowJsController Upload action (see below)., (*6)

<?= \leammas\yii2\flowjs\FlowJsWidget::widget([
    'clientOptions' => ['target' => "'" . Url::to(['/upload']) . "'"],
    'eventHandlers' => [],
    'options' => ['class' => 'btn btn-default', 'id' => 'flow_button'],
    'targetTag' => 'button',
    'targetContent' => 'Upload!'
]); ?>

Module

To save files uploaded by the widget, you should register this extension as an application module in your web.php:, (*7)

'modules' => [
    ...
    'flowjs' => 'leammas\yii2\flowjs\FlowJs'
],

After that you may check that the handler runs properly by accessing http://your.app/flowjs/flow-js/upload (this url suitable for activated enablePrettyUrl and deactivated showScriptName options, adjust to your needs). It should return 204 No Content response., (*8)

Also you may specify your own url in UrlManager, (*9)

'urlManager' => [
    ...
    'rules' => [
        ...
        'upload' => 'flowjs/flow-js/upload'
    ]
],

Known issues

  1. CSRF validation for upload disabled.
  2. You can't pass attributes parameter to assign methods. @see https://github.com/flowjs/flow.js#methods
  3. Passing files with drag-n-drop is not working.

The Versions

15/11 2015

dev-master

9999999-dev

Easy to use widget and controller for adding HTML5 fully customizable file upload to your app

  Sources   Download

MIT

The Requires

 

by Avatar leammas

extension yii2 widget flowjs upload flow-js flow-php yii2-flowjs html5