vova07/yii2-fileapi-widget

The FileAPI widget for Yii2 framework.

Maintainers

👁 vova07

Package info

github.com/vova07/yii2-fileapi-widget

Type:yii2-extension

pkg:composer/vova07/yii2-fileapi-widget

Statistics

Installs: 66 208

Dependents: 11

Suggesters: 0

Stars: 47

Open Issues: 8

0.1.9 2017-03-24 09:55 UTC

Requires (Dev)

None

Suggests

None

Provides

None

Conflicts

None

Replaces

None

BSD-3-Clause 110086027b6da7755834ff93ebc4476ef7b10b15

  • Crudu Vasile <bazillio07.woop@yandex.ru>

uploadfileswidgetyii2yii 2fileapimultiupload

This package is not auto-updated.

Last update: 2026-06-07 00:32:59 UTC


README

Yii2 FileAPI widget.

This widget is a Yii 2 wrapper of FileAPI plugin.

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist vova07/yii2-fileapi-widget "*"

or add

"vova07/yii2-fileapi-widget": "*"

to the require section of your composer.json file.

Usage:

// MyController.php

use vova07\fileapi\actions\UploadAction as FileAPIUpload;
...

public function actions()
{
 return [
 'fileapi-upload' => [
 'class' => FileAPIUpload::className(),
 'path' => '/path/to/temp/files'
 ]
 ];
}
// MyModel.php

use vova07\fileapi\behaviors\UploadBehavior;
...

public function behaviors()
{
 return [
 'uploadBehavior' => [
 'class' => UploadBehavior::className(),
 'attributes' => [
 'preview_url' => [
 'path' => '/path/to/previews',
 'tempPath' => '/path/to/temp/files/previews',
 'url' => '/url/to/previews'
 ],
 'image_url' => [
 'path' => '/path/to/images',
 'tempPath' => '/path/to/temp/files/images',
 'url' => '/url/to/images'
 ]
 ]
 ]
 ];
}
// _form.php

use vova07\fileapi\Widget as FileAPI;
...

echo $form->field($model, 'preview_url')->widget(
 FileAPI::className(),
 [
 'settings' => [
 'url' => ['/controller/fileapi-upload']
 ]
 ]
);