An enhanced HTML 5 file input for Bootstrap 3.x with features for file preview for many file types, multiple selection, ajax uploads, and more.

Fund package maintenance!
Open Collective

Installs: 3 255 054

Dependents: 20

Suggesters: 1

Security: 0

Stars: 4 964

Watchers: 390

Forks: 2 355

Open Issues: 5



Financial Contributors on Open Collective Bower version Latest Stable Version License Packagist Downloads Monthly Downloads

An enhanced HTML 5 file input for Bootstrap 5.x, 4.x, and 3.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 5.x, 4.x, and 3.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.

NEW: Bootstrap 5.x support is added from v5.2.0 (major release after v5.1.5) of the plugin. With v5.2.0, the plugin is able to automatically detect the bootstrap library version and deliver the relevant bootstrap specific functionality. Note that as of May 2021, for Bootstrap 5.x library, there is a modal dialog initialization issue recorded. This may in some cases break BC - so the version to rollback to is v5.1.5. However one should be able use release v5.2.0 without glitches if the right bootstrap Javascript library is loaded. Also check the $.fn.fileinputBsVersion setting for advanced use cases to avoid Bootstrap version detection issues.

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.

Krajee Default Theme

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.

Krajee Explorer Theme

Documentation and Demo

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


  1. Bootstrap 5.x, 4.x, or 3.x
  2. Latest JQuery
  3. 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.
  4. 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


  • Bootstrap 5.x is supported in addition to Bootstrap 3.x since release v5.2.0. Refer the CHANGE LOG for details.
  • 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.


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.


Step 1: Load the following assets in your header.

<!-- bootstrap 5.x and 4.x is supported. You can also use the bootstrap css 3.3.x versions -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/css/bootstrap.min.css">
<link href="https://cdn.jsdelivr.net/gh/kartik-v/bootstrap-fileinput@5.2.0/css/fileinput.min.css" media="all" rel="stylesheet" type="text/css" />
<!-- if using RTL (Right-To-Left) orientation, load the RTL CSS file after fileinput.css by uncommenting below -->
<!-- link href="https://cdn.jsdelivr.net/gh/kartik-v/bootstrap-fileinput@5.2.0/css/fileinput-rtl.min.css" media="all" rel="stylesheet" type="text/css" /-->
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
<!-- piexif.min.js is needed for auto orienting image files OR when restoring exif data in resized images and when you 
    wish to resize images before upload. This must be loaded before fileinput.min.js -->
<script src="https://cdn.jsdelivr.net/gh/kartik-v/bootstrap-fileinput@5.2.0/js/plugins/piexif.min.js" type="text/javascript"></script>
<!-- sortable.min.js is only needed if you wish to sort / rearrange files in initial preview. 
    This must be loaded before fileinput.min.js -->
<script src="https://cdn.jsdelivr.net/gh/kartik-v/bootstrap-fileinput@5.2.0/js/plugins/sortable.min.js" type="text/javascript"></script>
<!-- popper.min.js below is needed if you use bootstrap 4.x. You can also use the bootstrap js 
   3.3.x versions without popper.min.js. -->
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js"></script>
<!-- bootstrap.min.js below is needed if you wish to zoom and preview file content in a detail modal
    dialog. Bootstrap 5.x and 4.x is supported. You can also use the 3.3.x versions. -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/js/bootstrap.min.js" type="text/javascript"></script>
<!-- the main fileinput plugin file -->
<script src="https://cdn.jsdelivr.net/gh/kartik-v/bootstrap-fileinput@5.2.0/js/fileinput.min.js"></script>
<!-- optionally if you need a theme like font awesome theme you can include it as mentioned below -->
<script src="https://cdn.jsdelivr.net/gh/kartik-v/bootstrap-fileinput@5.2.0/themes/fa/theme.js"></script>
<!-- optionally if you need translation for your language then include  locale file as mentioned below (replace LANG.js with your locale file) -->
<script src="https://cdn.jsdelivr.net/gh/kartik-v/bootstrap-fileinput@5.2.0/js/locales/LANG.js"></script>

With v5.2.0, the plugin is able to automatically detect the bootstrap library version and deliver the relevant bootstrap specific functionality (if you have loaded the bootstrap.min.js before fileinput.min.js). In case of any issues - you can explicitly set the bootstrap version by setting the following variable before the plugin initialization script.

// set this before initializing the fileinput plugin
$.fn.fileinputBsVersion = '3.3.7'; // for example if using bootstrap css 3.3.7 version

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 <lang>.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.

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

// 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.

<input id="input-id" type="file" class="file" data-preview-file-type="text" >


Code Contributors

This project exists thanks to all the people who contribute. [Contribute]. 68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f626f6f7473747261702d66696c65696e7075742f636f6e7472696275746f72732e7376673f77696474683d38393026627574746f6e3d66616c7365

Financial Contributors

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




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

68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f626f6f7473747261702d66696c65696e7075742f6f7267616e697a6174696f6e2f302f6176617461722e737667 68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f626f6f7473747261702d66696c65696e7075742f6f7267616e697a6174696f6e2f312f6176617461722e737667 68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f626f6f7473747261702d66696c65696e7075742f6f7267616e697a6174696f6e2f322f6176617461722e737667 68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f626f6f7473747261702d66696c65696e7075742f6f7267616e697a6174696f6e2f332f6176617461722e737667 68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f626f6f7473747261702d66696c65696e7075742f6f7267616e697a6174696f6e2f342f6176617461722e737667 68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f626f6f7473747261702d66696c65696e7075742f6f7267616e697a6174696f6e2f352f6176617461722e737667 68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f626f6f7473747261702d66696c65696e7075742f6f7267616e697a6174696f6e2f362f6176617461722e737667 68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f626f6f7473747261702d66696c65696e7075742f6f7267616e697a6174696f6e2f372f6176617461722e737667 68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f626f6f7473747261702d66696c65696e7075742f6f7267616e697a6174696f6e2f382f6176617461722e737667 68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f626f6f7473747261702d66696c65696e7075742f6f7267616e697a6174696f6e2f392f6176617461722e737667


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