File Upload widget with multiple file selection, drag&drop support, progress bar, validation and preview images, audio and video for jQuery

Last update: Jun 30, 2022

jQuery File Upload

Contents

Description

File Upload widget with multiple file selection, drag&drop support, progress bars, validation and preview images, audio and video for jQuery.
Supports cross-domain, chunked and resumable file uploads and client-side image resizing.
Works with any server-side platform (PHP, Python, Ruby on Rails, Java, Node.js, Go etc.) that supports standard HTML form file uploads.

Demo

Demo File Upload

Features

  • Multiple file upload:
    Allows to select multiple files at once and upload them simultaneously.
  • Drag & Drop support:
    Allows to upload files by dragging them from your desktop or file manager and dropping them on your browser window.
  • Upload progress bar:
    Shows a progress bar indicating the upload progress for individual files and for all uploads combined.
  • Cancelable uploads:
    Individual file uploads can be canceled to stop the upload progress.
  • Resumable uploads:
    Aborted uploads can be resumed with browsers supporting the Blob API.
  • Chunked uploads:
    Large files can be uploaded in smaller chunks with browsers supporting the Blob API.
  • Client-side image resizing:
    Images can be automatically resized on client-side with browsers supporting the required JS APIs.
  • Preview images, audio and video:
    A preview of image, audio and video files can be displayed before uploading with browsers supporting the required APIs.
  • No browser plugins (e.g. Adobe Flash) required:
    The implementation is based on open standards like HTML5 and JavaScript and requires no additional browser plugins.
  • Graceful fallback for legacy browsers:
    Uploads files via XMLHttpRequests if supported and uses iframes as fallback for legacy browsers.
  • HTML file upload form fallback:
    Allows progressive enhancement by using a standard HTML file upload form as widget element.
  • Cross-site file uploads:
    Supports uploading files to a different domain with cross-site XMLHttpRequests or iframe redirects.
  • Multiple plugin instances:
    Allows to use multiple plugin instances on the same webpage.
  • Customizable and extensible:
    Provides an API to set individual options and define callback methods for various upload events.
  • Multipart and file contents stream uploads:
    Files can be uploaded as standard "multipart/form-data" or file contents stream (HTTP PUT file upload).
  • Compatible with any server-side application platform:
    Works with any server-side platform (PHP, Python, Ruby on Rails, Java, Node.js, Go etc.) that supports standard HTML form file uploads.

Security

⚠️ Please read the VULNERABILITIES document for a list of fixed vulnerabilities

Please also read the SECURITY document for instructions on how to securely configure your Web server for file uploads.

Setup

jQuery File Upload can be installed via NPM:

npm install blueimp-file-upload

This allows you to include jquery.fileupload.js and its extensions via node_modules, e.g:

">
<script src="node_modules/blueimp-file-upload/js/jquery.fileupload.js">script>

The widget can then be initialized on a file upload form the following way:

$('#fileupload').fileupload();

For further information, please refer to the following guides:

Requirements

Mandatory requirements

Optional requirements

Cross-domain requirements

Cross-domain File Uploads using the Iframe Transport plugin require a redirect back to the origin server to retrieve the upload results. The example implementation makes use of result.html as a static redirect page for the origin server.

The repository also includes the jQuery XDomainRequest Transport plugin, which enables limited cross-domain AJAX requests in Microsoft Internet Explorer 8 and 9 (IE 10 supports cross-domain XHR requests).
The XDomainRequest object allows GET and POST requests only and doesn't support file uploads. It is used on the Demo to delete uploaded files from the cross-domain demo file upload service.

Browsers

Desktop browsers

The File Upload plugin is regularly tested with the latest browser versions and supports the following minimal versions:

  • Google Chrome
  • Apple Safari 4.0+
  • Mozilla Firefox 3.0+
  • Opera 11.0+
  • Microsoft Internet Explorer 6.0+

Mobile browsers

The File Upload plugin has been tested with and supports the following mobile browsers:

  • Apple Safari on iOS 6.0+
  • Google Chrome on iOS 6.0+
  • Google Chrome on Android 4.0+
  • Default Browser on Android 2.3+
  • Opera Mobile 12.0+

Extended browser support information

For a detailed overview of the features supported by each browser version and known operating system / browser bugs, please have a look at the Extended browser support information.

Testing

The project comes with three sets of tests:

  1. Code linting using ESLint.
  2. Unit tests using Mocha.
  3. End-to-end tests using blueimp/wdio.

To run the tests, follow these steps:

  1. Start Docker.
  2. Install development dependencies:
    npm install
  3. Run the tests:
    npm test

Support

This project is actively maintained, but there is no official support channel.
If you have a question that another developer might help you with, please post to Stack Overflow and tag your question with blueimp jquery file upload.

License

Released under the MIT license.

GitHub

https://github.com/blueimp/jquery-file-upload
Comments
  • 1. Error: SyntaxError: Unexpected token <

    Hi im trying to upload images files but everytime i push upload

    i get this - Error: SyntaxError: Unexpected token <

    pleas help and thx for any help.

    Reviewed by Dacarts at 2011-09-25 13:08
  • 2. Upload multiple files directly to S3?

    I have been using Jquery-file-upload plugin with paperclip and S3 for quite a while now and I really like it. However, as the files I need to upload become bigger, uploading directly to S3 becomes my only choice.

    This article demonstrates how to upload a single file to S3, unfortunately it doesn't do multiple files uploading.
    https://github.com/blueimp/jQuery-File-Upload/wiki/Upload-directly-to-S3

    so my question is, is it possible to iterate through a list of files and create a single post form for each file on the fly?

    Or is it possible to create an independent form and then repopulate the field in each iteration?

    Any tips are greatly appreciated.

    Reviewed by Kickyourassforever at 2011-12-30 03:05
  • 3. Retain EXIF and ICC headers with client-side image processing

    It seems like it should be possible to retain the ICC and EXIF data by extracting the APP2 segment data from the original image and re-attach it to the resized image.

    ICC Color Profiles? For those unfamiliar, let me explain: Perhaps you have heard of sRGB, RGB, CMYK, etc. These are color mappings that instruct devices how to render the colors. When this data is stripped from the image, the colors get all fucked up. Eg. CMYK image is upload, profile is stripped, server displays image, browser reads is as untagged RGB, displays in sRGB color space, resulting wrong colors. Blues shift to purple, grey to black, etc.

    Normally the best way to manage mismatched color spaces is through conversion with Image Magick (reading the source profile and then converting to sRGB, which is a standardized color profile for computer monitors).

    However, once the image has the ICC profile stripped with Canvas resize, the conversion cannot be peformed in Image magick because the original color space is unknown.

    I've seen a solution for this (Grabbing the ICC info from the JPG header and reinserting it) in pupload: https://github.com/moxiecode/plupload/blob/master/src/javascript/plupload.html5.js

    However, I have been unsuccessful thus far in integrating it.

    Reviewed by edeis at 2012-04-16 17:26
  • 4. All works but "Empty file upload result" error appears

    I'm using basic example and keep getting "Empty file upload result" error although all files are uploading correctly. I checked permissions for "files" and "thumbnails" folders - it's okay too (I tried 775 and 777). Can somebody help me?

    Reviewed by michellekg at 2011-06-03 14:46
  • 5. Problems with iframe upload

    So I had the uploader setup and working just fine, or so I thought ... turns out it didn't work in IE because it (in all its iterations) does not support AJAX uploads. So I've been trying to get it to work with the options 'forceIframeTransport' set to true.

    I have the basic plugin included, the iframe-transport file too ... and I have the upload script on the server returning text/html as advised in the documentation. I have it working ... almost ... all the variables are getting sent to the server properly except the actual file and I can't figure out why.

    At first I thought it was just an IE thing, but with the 'forceIframeTransport' option set to true, google Chrome is doing the same thing.

    I 'm worried that I might not fully understand what 'The Iframe Transport requires a file input selection to upload files.' means. I have a file input, which I'm using to add file info to the UI for each file selection ... is there something I'm missing?

    Reviewed by concept47 at 2011-09-21 17:23
  • 6. Problem with new codeigniter example

    Hello, I tried to setup codeigniter with new example, but I keep getting error when I click "Start Upload": Unable to load the requested file: upload.php

    Images are uploaded in the uploads file, but the error is there (setup I made is the same as one in the example). Also, at the end of example author put following line: I had a problem with seeing images/thumbnails initially then I realized I had not set uploads/ directory in my .htacces file

    I am new to .htacces, so I don't know how to do this part. Can someone help me?

    Reviewed by Brav at 2012-02-20 09:57
  • 7. Plugin does not initialize with Version 5.0

    When I'm trying to initialize the plugin on the file upload control

    if('undefined' !== $.type($('input[type=file][name=userfile]')[0])) {
        var file_input = $('input[type=file][name=userfile]');
    
        file_input.fileUploadUI({
            uploadTable: $('#files'),
            buildUploadRow: function (files, index, handler) {
                return $('<tr><td>' + files[index].name + '<\/td>' +
                        '<td class="file_upload_progress"><div><\/div><\/td>' +
                        '<td class="file_upload_cancel">' +
                        '<button class="ui-state-default ui-corner-all" title="Cancel">' +
                        '<span class="ui-icon ui-icon-cancel">Cancel<\/span>' +
                        '<\/button><\/td><\/tr>');
            },
        });
    }
    

    it says: file_input.fileUploadUI is not a function

    All the dependencies are present, either css or js files, Firebug shows them loaded and ready to run.

    Some info: I'm using it in SugarCRM environment, so I've added the links to the files into the head part of the page, where the scripts and styles normally should be. The idea was to apply and initialize it to file upload control programmatically only in the case, when this control is present in the form. I don't want to apply this plugin to the whole form because this form is a part of Wizard step and any intervention into the form's normal functionality will destroy the wizard logic. The only task, the plugin can do for me is form-independent upload of the imported file before the user goes to the next Wizard step.

    Also, the Steps load themselves via AJAX ($('#content_td').html(xhr.responseText)), so there is no place for $(function) like in the examples, because it requires the page to be reloaded to initialize it.

    If it is not a bug and I'm doing anything wrong, please help me to figure out what it exactly is. Thank you.

    Reviewed by gadeshi at 2011-05-17 14:40
  • 8. IE 8 problem

    Itry the new code on firefox and all go well, but if i try to upload a file on ie 8 a pop up show out asking me to download upload.php file. Anyone know why?

    Reviewed by Manolo2 at 2011-04-27 08:53
  • 9. Error: [object Error] in Internet Explorer

    Great project, thank you!

    However, I'm trying to implement the uploader. It works perfectly in FF, Chrome and Safari, but IE7, 8, 9 all fail to load the JSON response correctly.

    My server-side uploader is correctly making the images on the server, but IE only returns Error: [object Error] highlighted in red, rather than the JSON return of thumbnail, url etc.

    Are there any tips or guidance you can supply on trying to resolve or debug this IE only issue?

    Reviewed by carlospictor at 2011-09-29 16:26
  • 10. IE9 Cross domain upload issue

    Hi, while trying to upload to distance server, im getting this error:

    SCRIPT5: Access is denied. jquery.js, line 3241 character 6

    When i comment iframe_transport.js and include xdr-transport.js i stop getting the error and the post request send but the file isnt (empty $_FILE on server) and i get this error: No conversion from text to iframe

    Any ideas? Thanks.

    Reviewed by orenyakobi at 2012-05-31 13:20
  • 11. iOS + EXIF Orientation Broken

    This was an issue previously but was fixed but it appears it's back but with strange symptoms.

    The scenario:

    • Open the demo website in iOS 6 device (I am on latest version of 6)
    • Upload a photo taken on the device
    • Preview and final upload result have correct orientation on iOS in safari and used as img src: Image gallery - http://c.sampotts.me/RSlx Safari - http://c.sampotts.me/RTA6
    • View it directly in a browser, no problems: http://c.sampotts.me/RSK1
    • The problems start when you then use within a web page (img src): Chrome - http://c.sampotts.me/RSau Safari - http://c.sampotts.me/RT8z Firefox - http://c.sampotts.me/RSX1

    It seems all orientations on iOS result in strange output.

    Obviously this boils down to the EXIF orientation as regular portrait and landscape images taken with a DSLR are not an issue. I've not looked into it but I believe there are 8 possible EXIF orientation values, perhaps it's possible to reset the correct value. I'll look into it further and report back.

    Reviewed by ghost at 2013-09-18 12:21
  • 12. $.type is deprecated

    Using $.type is deprecated according to the jQuery Migration 3.3.2 tool.

    See: https://github.com/jquery/jquery-migrate/blob/main/warnings.md#jqmigrate-jquerytype-is-deprecated

    Cause: This method returns a string that indicates the type of the argument, for example "number" or "function". However, as the JavaScript language evolves this method has become problematic because new language constructs might require this function to either return a new string (potentially breaking existing code) or somehow map new constructs into existing strings (again, potentially breaking existing code). Examples of new recent JavaScript features include asynchronous functions, class constructors, Symbols, or functions that act as iterators.

    Solution: Review code that uses jQuery.type() and use a type check that is appropriate for the situation. For example. if the code expects a plain function, check for typeof arg === "function".

    Reviewed by melloware at 2021-09-05 12:28
  • 13. Client side resize bad aliasing depending on browser

    Hello,

    This is not so much a "bug" as trying to learn about something we observe and maybe understanding if there can be improvements.

    We use client side resize in jquery upload to resize images to around 1200x825px height.

    We've noticed that Firefox and Chrome have noticeably different image quality after resize, but both leave much more aliasing in angled lines than server side Imagick does with its default filters (Lanczos or Mitchell).

    Is this something that can be improved somehow? Are some browsers better than others with client side resize, and what are they?

    I took an image and uploaded with client side resize off, then with it "on" in Chrome and Firefox, and I cropped out a section from each sample to demonstrate the most obvious artifacts:

    example_resize_jqueryupload

    The angled line is the most obvious, but even if you look at the "psb speakers" logo you can clearly see the Imagic resize is cleaner than the other two, especially compared to Firefox which has the worst resize.

    Is there any way to set the client side resize to use better or different resize algorithms?

    Reviewed by redemption at 2021-04-06 22:05
  • 14. Deprecated function usage in jquery-ui

    There's been some work towards removing deprecated function usage over the last few months. It seems the below haven't been pointed out before, so here goes:

    jQuery.isArray is deprecated; use Array.isArray

    • https://github.com/blueimp/jQuery-File-Upload/blob/f5d629abdaf480fefad8ad823cb1e2c96805bd4e/js/jquery.fileupload-ui.js#L86

    jQuery. isFunction() is deprecated. In most cases, its use can be replaced by typeof x === "function"

    • https://github.com/blueimp/jQuery-File-Upload/blob/d2535157e6005eb3c37f7d0b0042462393139c5b/js/vendor/jquery.ui.widget.js#L134
    • https://github.com/blueimp/jQuery-File-Upload/blob/d2535157e6005eb3c37f7d0b0042462393139c5b/js/vendor/jquery.ui.widget.js#L276
    Reviewed by bytestream at 2020-08-12 12:26
  • 15. Callback after bulk delete

    Bulk delete implementation simply looks up delete buttons of selected items in file list and triggers click on them.

    https://github.com/blueimp/jQuery-File-Upload/blob/master/js/jquery.fileupload-ui.js#L638

    Would be great if the delete requests get tracked and an event gets fired after bulk deletion completes.

    Usecase is reloading of some parts of the page after bulk delete.

    Reviewed by rnixx at 2020-07-06 08:14
  • 16. Colors are changed when using Client-Side image resize

    Hello,

    When I'm uploading the attached photo and resizing the image using the 'imageMaxWidth' and 'imageMaxHeight' options, the image's colors are changed.

    When I'm not using the above options or set them to 'Number.MAX_SAFE_INTEGER', the colors are the same as the original image.

    Here is the original image: 20_Nis_Rogue_Sport-039-source

    Here is the result after uploaded to your demo site (which using 'imageMaxWidth' and 'imageMaxHeight'):

    Reviewed by cb-eli at 2020-06-18 10:56
Magento 2 Preview/Visit Catalog allows the store owner to quickly preview the catalog (product & category) pages from the admin panel.
Magento 2 Preview/Visit Catalog allows the store owner to quickly preview the catalog (product & category) pages from the admin panel.

Magento 2 Preview/Visit Catalog Overview Magento 2 Preview/Visit Catalog allows the store owner to quickly preview the catalog (product & category) pa

Feb 11, 2022
The Workflow Package add Drag & Drop Workflows to your Laravel Application.
The Workflow Package add Drag & Drop Workflows to your Laravel Application.

Workflows add Drag & Drop automation's to your Laravel application. The Workflow Package adds Drag & Drop Workflows to your Laravel Application. A Wor

Jun 25, 2022
PHP FFmpeg - An Object Oriented library to convert video/audio files with FFmpeg / AVConv

PHP FFmpeg An Object Oriented library to convert video/audio files with FFmpeg / AVConv. Check another amazing repo: PHP FFMpeg extras, you will find

May 4, 2021
BreadBooru is a light, quick, and easy to setup imageboard with themes, images, and video support
BreadBooru is a light, quick, and easy to setup imageboard with themes, images, and video support

BreadBooru a bad imageboard, that has nothing to do with (dan/gel)booru, and yet still has booru in the name BreadBooru is a light, quick, and easy to

Jan 22, 2022
Api.video-wordpress-plugin - The official api.video plugin for WordPress
Api.video-wordpress-plugin - The official api.video plugin for WordPress

api.video WordPress Plugin api.video is the video infrastructure for product builders. Lightning fast video APIs for integrating, scaling, and managin

May 24, 2022
A web app for the resolution of a mobile game in wich you have 4 images and a list of letters, then a few boxes to fill with the word connecting the four images.

4images_1mot_solutions A web app for the resolution of a mobile game in wich you have 4 images and a list of letters, then a few boxes to fill with th

Jan 13, 2022
Tool for easy selection and export of user files in ZIP format.

Personal data export Idea Tool for easy selection and export of user files in ZIP format. Within a single selector, you choose all user data (much of

Oct 18, 2021
Simple EProgress application for selection purposes

E-Progress Aplikasi pengelolaan data mahasiswa anggota UKM Progress sederhana. Daftar Isi ??️ E-Progress Daftar Isi ??️ Instalasi ?? Penggunaan ⚙️ Kon

Oct 26, 2021
S11 Selection est une solution web PHP faite pour automatiser la création d'une grille d'évaluation d'un étudiant puis de les rassembler pour en faire un classement.

[S11] SELECTION BTS 0.1.0 FR Description S11 Selection est une solution web PHP faite pour automatiser la création d'une grille d'évaluation d'un étud

Mar 23, 2022
Detect flaws in your architecture, before they drag you down into the depths of dependency hell ...
Detect flaws in your architecture, before they drag you down into the depths of dependency hell ...

Detect flaws in your architecture before they drag you down into the depths of dependency hell ... What it does System Requirements Installation Phive

Jun 10, 2022
A faster drop in replacement for bin/magento cache:clean with file watcher

"You know, hope is a mistake. If you can't fix what's broken, you'll, uh... you'll go insane." - Max Rockatansky Magento 2 Cache Clean A faster drop i

Jun 22, 2022
Quickly and easily preview and test your Magento 2 order confirmation page, without hacks or spending time placing new order each time
Quickly and easily preview and test your Magento 2 order confirmation page, without hacks or spending time placing new order each time

Preview Order Confirmation Page for Magento 2 For Magento 2.0.x, 2.1.x, 2.2.x and 2.3.x Styling and testing Magento's order confirmation page can be a

May 19, 2022
A script to retrieve data from a Netatmo weather station and display it in a Mac menu bar.

weathermenu A script to retrieve data from a Netatmo weather station and display it in a Mac menu bar. Intended for use with SwiftBar. Configuration N

Nov 4, 2021
Envbar allows you to differentiate between environments by adding a custom colored bar above the top navigation.
Envbar allows you to differentiate between environments by adding a custom colored bar above the top navigation.

Envbar Envbar allows you to differentiate between environments by adding a custom colored bar above the top navigation. This should help backend users

Apr 10, 2022
For the super admin, replace WP Admin Bar My Sites menu with an All Sites menu.
For the super admin, replace WP Admin Bar My Sites menu with an All Sites menu.

Super Admin All Sites Menu Also available at https://wordpress.org/plugins/super-admin-all-sites-menu/ Use | Prerequisite | Install | Filters | Demo |

Apr 4, 2022
Extends the Debug Bar plugin for the Sophi.io Site Automation service.
Extends the Debug Bar plugin for the Sophi.io Site Automation service.

Debug Bar for Sophi Extends the Debug Bar plugin for the Sophi.io Site Automation service. Requirements PHP 7.4+ WordPress 5.6+ Sophi 1.1.0+ Debug Bar

Jun 22, 2022
Create and update progress bars in different environments

Create and update progress bars in different environments

Jan 17, 2022
A dockerized PHP application containing some file upload vulnerability challenges (scenarios)

File Upload Vulnerability Scenarios (Challenges) This repository is a dockerized PHP application containing some file upload vulnerability challenges

May 9, 2022
File uploads with validation and storage strategies

Upload This component simplifies file validation and uploading. Usage Assume a file is uploaded with this HTML form: <form method="POST" enctype="mult

Jun 24, 2022