bootstrap file input ajax,bootstrap-fileinput

8bcdb62efdce51e5556e08326836d642.png

bootstrap-fileinput

cb10b08c6e7d61410389334689a34048.png

badge.svg?label=financial+contributors

bootstrap-fileinput.svg

stable

license

downloads

monthly

An enhanced HTML 5 file input for Bootstrap 3.x and 4.x with file preview for various files, offers multiple selection, resumable chunk uploads, and more. The plugin allows you a simple way to setup an advanced file picker/upload control built to work specially with Bootstrap 3.x or 4.x CSS3 styles. It enhances the file input functionality further, by offering support to preview a wide variety of files i.e. images, text, html, video, audio, flash, and objects. In addition, it includes AJAX based uploads, dragging & dropping files, viewing upload progress, and selectively previewing, adding, or deleting files.

NOTE: Version 5.x is a significant rewrite. With version 5.x, the plugin code has been revamped with enhanced file management, resumable chunk uploads support, and other new features. You can go through the various closed enhancements and features and documented for Release 5.x milestone.

2117d25b114f029446f1caa8f4c9b100.png

NOTE: An alternative new Krajee Explorer Theme (preview shown below) for bootstrap-fileinput has been released and available since v4.3.7. For more theming options and suggestions refer the theming demos.

ab0e501ba3e204cd7ae73fa8bbb94962.png

Documentation and Demo

View the plugin documentation and plugin demos at Krajee JQuery plugins.

Pre-requisites

Latest JQuery

Most modern browsers supporting HTML5 (inputs and FileReader API) including CSS3 & JQuery. For Internet Explorer, one must use IE versions 10 and above. IE9 and below will work as a normal file input, and will not support multiple file selection or the HTML 5 FileReader API.

With release 4.0, AJAX uploads are supported. AJAX uploads require that the browser support HTML5 FormData and XHR2 (XMLHttpRequest 2). Most modern browsers support FormData and XHR2. The plugin will automatically degrade to normal form based submission for browsers not supporting AJAX uploads

NOTE:

Bootstrap 4.x is supported in addition to Bootstrap 3.x since release v4.4.4. Refer the CHANGE LOG for details.

You can use the sass branch for installation using bootstrap-sass dependency.

The master branch can be used for installation using plain bootstrap dependency.

Installation

Using Bower

To install using the bower package manager run:

bower install bootstrap-fileinput

Using NPM

To install using the npm package manager run:

npm install bootstrap-fileinput

Using Composer

To install using the composer package manager run:

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

or add:

"kartik-v/bootstrap-fileinput": "@dev"

to your composer.json file

Manual Install

You can also manually install the plugin easily to your project. Just download the source ZIP or TAR ball and extract the plugin assets (css and js folders) into your project.

Usage

Step 1: Load the following assets in your header.

If you noticed, you need to load the jquery.min.js and bootstrap.min.css in addition to the fileinput.min.css and fileinput.min.js. The theme file themes/fa/theme.js can be optionally included for the font awesome icons styling. The locale file .js can be optionally included for translating for your language if needed.

Optional Dependent Plugins

The piexif.min.js file is the source for the Piexifjs plugin by hMatoba. It is required to be loaded before fileinput.min.js if you wish to use the image resize feature of the bootstrap-fileinput plugin.

The sortable.min.js file is the source for the Sortable plugin by rubaxa. It is required to be loaded before fileinput.min.js if you wish to sort the thumbnails in the initial preview.

The purify.min.js file is the source for the DomPurify plugin by cure53. It is required to be loaded before fileinput.min.js if you wish to purify your HTML for HTML content preview.

For ease of access, the sources for the above plugins are included in the js/plugins folder of this project repository.

Step 2: Initialize the plugin on your page. For example,

// initialize with defaults

$("#input-id").fileinput();

// with plugin options

$("#input-id").fileinput({'showUpload':false, 'previewFileType':'any'});

The #input-id is the identifier for the input (e.g. type = file) on your page, which is hidden automatically by the plugin.

Alternatively, you can directly call the plugin options by setting data attributes to your input field.

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

db24a484c7bd6b7ef918fe7240e8b368.png

7b1dc58b9b451a3058d11e08fe3a6eeb.png

594689ea1d264496a0117e62bab5e755.png

fc375582784cdb96f5932ea68e5183f9.png

3df95526126588afac3f40ab95e1925b.png

863c6d43fd7fce19aec43138053cfa6e.png

48b21d02c30ec2a945d5aaabc42104ae.png

cf3a281879c25a41406020c8dc52732d.png

0a8c2ab5e5e09167c7894e79132a9bc1.png

License

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值