kartik-v/yii2-widget-fileinput An enhanced FileInput widget for Bootstrap 3.x, 4.x & 5.x with file preview, multiple selection, and more features (sub repo split from yii2-widgets)

extensionwidgetfileuploadjquerypluginforminput

Krajee Logo
yii2-widget-fileinput Donate

Stable Version Unstable Version License Total Downloads Monthly Downloads Daily Downloads

The FileInput widget is a customized file input widget based on Krajee's Bootstrap FileInput JQuery Plugin. The widget enhances the default HTML file input with various features including the following:

  • Specially styled for Bootstrap 3.x, 4.x and 5.x with customizable buttons, caption, and preview
  • Ability to select and preview multiple files
  • Includes file browse and optional remove and upload buttons.
  • Ability to format your file picker button styles
  • Ability to preview files before upload - images and/or text (uses HTML5 FileReader API)
  • Ability to preview multiple files of different types (both images and text)
  • Set your upload action/route (defaults to form submit). Customize the Upload and Remove buttons.
  • Internationalization enabled for easy translation to various languages

NOTE: This extension is a sub repo split of yii2-widgets. The split has been done since 08-Nov-2014 to allow developers to install this specific widget in isolation if needed. One can also use the extension the previous way with the whole suite of yii2-widgets.

Installation

The preferred way to install this extension is through composer. Check the composer.json for this extension's requirements and dependencies. Read this web tip /wiki on setting the minimum-stability settings for your application's composer.json.

To install, either run

$ php composer.phar require kartik-v/yii2-widget-fileinput "@dev"

or add

"kartik-v/yii2-widget-fileinput": "@dev"

to the require section of your composer.json file.

Refer the CHANGE LOG for details of release wise changes.

Demo

You can refer detailed documentation and demos on usage of the extension.

Usage

use kartik\file\FileInput;

// Usage with ActiveForm and model
echo $form->field($model, 'avatar')->widget(FileInput::classname(), [
    'options' => ['accept' => 'image/*'],
]);

// With model & without ActiveForm
echo '<label class="control-label">Add Attachments</label>';
echo FileInput::widget([
    'model' => $model,
    'attribute' => 'attachment_1',
    'options' => ['multiple' => true]
]);

Contributors

Code Contributors

This project exists thanks to all the people who contribute. [Contribute]. contributors.svg?width=890&button=false

Financial Contributors

Become a financial contributor and help us sustain our community. [Contribute]

Individuals

individuals.svg?width=890

Organizations

Support this project with your organization. Your logo will show up here with a link to your website. [Contribute]

avatar.svg avatar.svg avatar.svg avatar.svg avatar.svg avatar.svg avatar.svg avatar.svg avatar.svg avatar.svg

License

yii2-widget-fileinput is released under the BSD-3-Clause License. See the bundled LICENSE.md for details.

Changelog

Change Log: yii2-widget-fileinput

Version 1.1.1

Date: 28-Jun-2022

  • (enh #186): New property autoFileTypeParsing for parsing file types.
  • (enh #185): Add Uzbek (Cyrillic) language translations.
  • (enh #184): Add Uzbek (Cyrillic) language in messages config.
  • (enh #180): Enhancements to support Bootstrap v5.x.
  • (bug #179): Support translations for language codes with hyphen.

Version 1.1.0

Date: 24-Oct-2020

  • (enh #171): Eliminate DOM Purify plugin and assets dependencies.
  • (enh #169): Add German Translations.
  • (enh #165): Add Latvian Translations.
  • (enh #162): Add Uzbek Translations.
  • (enh #159): Add Romanian Translations.
  • (enh #157): Add Armenian Translations.
  • Bump composer dependencies.

Version 1.0.9

Date: 19-Apr-2019

  • (enh #147): Auto-set multiple file upload naming convention.
  • Bump composer dependencies.

Version 1.0.8

Date: 19-Sep-2018

  • Bump version.

Version 1.0.7

Date: 07-Sep-2018

  • Updates to support Bootstrap 4.x.
  • (kartik-v/yii2-krajee-base#94): Refactor code and consolidate / optimize properties within traits.
  • Reorganize relevant code in "src" directory.
  • Optimize asset bundles.
  • (enh #134): Add Slovak Translations.
  • (enh #126): Add Finnish Translations.
  • (enh #120): Add Explorer FA Theme support.

Version 1.0.6

Date: 26-May-2017

  • Enhancements for plugin v4.4.1 (inclusion of PiExifAsset and removal of CanvasBlobAsset).
  • Add github contribution and issue/PR log templates.
  • Update copyright year to current.
  • (enh #117): Add Bulgarian Translations.
  • (enh #114): Automatically add enctype to form options when using with Yii Active Field and Active Form.
  • (enh #112): Add Explorer Theme support.
  • (enh #90): Fixed namespace fatal error.
  • (enh #88): Add Vietnamese Translations.
  • (enh #79): Add Lithuanian Translations.

Version 1.0.5

Date: 16-Jun-2016

  • (enh #74): Add Ukranian Translations.
  • (enh #71): Enhancements for plugin v4.3.2.
  • (enh #70): Add Estonian Translations.
  • Add branch alias for dev-master latest release.

Version 1.0.4

Date: 10-Jan-2016

  • (enh #58): Enhancements for PJAX based reinitialization. Complements enhancements in kartik-v/yii2-krajee-base#52 and kartik-v/yii2-krajee-base#53.
  • (enh #57): Enhance localizations and allow yii to generate message files via config.
  • (enh #40): Add Persian Translations
  • (enh #37): Add Greek Translations
  • (enh #36): Add Indonesian Translations

Version 1.0.3

Date: 26-Jun-2015

  • (bug #33): Initialize language correctly.

Version 1.0.2

Date: 03-May-2015

  • (enh #29): Better validation for graceful downgrade for older browsers.
  • (enh kartik-v/yii2-krajee-base#34, kartik-v/yii2-krajee-base#35): Enhance i18n translation locales.
  • (enh #23): Add Chinese translations.

Version 1.0.1

Date: 30-Mar-2015

  • (enh #22): Added Thai language translations.
  • (enh #21): Updates to widget for v4.1.8 bootstrap-fileinput plugin
    • All plugin related translations now reside in the locales files in the plugin folder. Pull requests for new translations or editing translations needs to be done in the plugin folder.
    • The language property can be set at the widget level to set the language (this will default to Yii::$app->language).
  • (enh #20): Croatian translations
  • (enh #4): Hungarian translations

Version 1.0.0

Date: 08-Nov-2014

Statistics

Downloads
GitHub Stars
GitHub Forks

Releases

Comments



v1.1.1 is the latest of 12 releases



BSD-3-Clause license
Stats
229 github stars & 96 github forks
3121 downloads in the last day
78058 downloads in the last 30 days
5498066 total downloads