Convert Figma logo to code with AI

blueimp logojQuery-File-Upload

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

30,965
7,957
30,965
52

Top Related Projects

Multiple file upload plugin with image previews, drag and drop, progress bars. S3 and Azure support, image scaling, form support, chunking, resume, pause, and tons of other features.

18,054

Dropzone is an easy to use drag'n'drop library. It supports image previews and shows nice progress bars.

28,920

The next open source file uploader for web browsers :dog:

15,052

🌊 A flexible and fun JavaScript file upload library

An enhanced HTML 5 file input for Bootstrap 5.x/4.x./3.x with file preview, multiple selection, and more features.

2,959

A JavaScript library providing multiple simultaneous, stable, fault-tolerant and resumable/restartable file uploads via the HTML5 File API.

Quick Overview

jQuery File Upload is a popular open-source plugin that adds file upload functionality to web applications. It supports multiple file selection, drag & drop uploads, progress bars, and preview images for various file types. The plugin is highly customizable and works well with both client-side and server-side processing.

Pros

  • Easy integration with existing jQuery-based projects
  • Extensive browser support, including older versions
  • Highly customizable with a wide range of options and callbacks
  • Supports both client-side and server-side processing of uploads

Cons

  • Relies on jQuery, which may not be ideal for modern JavaScript frameworks
  • Large file size compared to more lightweight alternatives
  • Some advanced features require additional plugins or dependencies
  • Documentation can be overwhelming for beginners due to the many options available

Code Examples

  1. Basic initialization:
$('#fileupload').fileupload({
    url: '/upload',
    done: function (e, data) {
        console.log('Upload complete');
    }
});
  1. Adding drag and drop support:
$('#dropzone').fileupload({
    url: '/upload',
    dropZone: $('#dropzone')
});
  1. Customizing allowed file types and max file size:
$('#fileupload').fileupload({
    url: '/upload',
    acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i,
    maxFileSize: 5000000 // 5 MB
});

Getting Started

  1. Include the necessary files in your HTML:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script src="js/vendor/jquery.ui.widget.js"></script>
<script src="js/jquery.fileupload.js"></script>
  1. Create a file input element in your HTML:
<input id="fileupload" type="file" name="files[]" multiple>
  1. Initialize the plugin with basic options:
$(function () {
    $('#fileupload').fileupload({
        url: '/upload',
        dataType: 'json',
        done: function (e, data) {
            $.each(data.result.files, function (index, file) {
                $('<p/>').text(file.name).appendTo('#files');
            });
        }
    });
});

This setup provides a basic file upload functionality. You can further customize the plugin by adding more options and callbacks as needed.

Competitor Comparisons

Multiple file upload plugin with image previews, drag and drop, progress bars. S3 and Azure support, image scaling, form support, chunking, resume, pause, and tons of other features.

Pros of Fine-Uploader

  • More comprehensive and feature-rich, offering advanced capabilities like chunking, resume, and drag-and-drop
  • Better cross-browser compatibility, including support for older browsers
  • Actively maintained with regular updates and improvements

Cons of Fine-Uploader

  • Steeper learning curve due to its extensive feature set
  • Larger file size, which may impact page load times
  • Commercial license required for certain use cases

Code Comparison

Fine-Uploader:

var uploader = new qq.FineUploader({
    element: document.getElementById('uploader'),
    request: {
        endpoint: '/server/upload'
    }
});

jQuery-File-Upload:

$('#fileupload').fileupload({
    url: '/server/upload',
    dataType: 'json',
    done: function (e, data) {
        $.each(data.result.files, function (index, file) {
            $('<p/>').text(file.name).appendTo('#files');
        });
    }
});

Both libraries provide easy-to-use interfaces for file uploads, but Fine-Uploader offers a more object-oriented approach with additional configuration options. jQuery-File-Upload relies on jQuery and provides a simpler setup for basic use cases. The choice between the two depends on project requirements, desired features, and development preferences.

18,054

Dropzone is an easy to use drag'n'drop library. It supports image previews and shows nice progress bars.

Pros of Dropzone

  • Lightweight and standalone (no jQuery dependency)
  • More modern and actively maintained
  • Extensive customization options and theming capabilities

Cons of Dropzone

  • Steeper learning curve for beginners
  • Less comprehensive server-side integration examples
  • May require more setup for advanced features

Code Comparison

jQuery-File-Upload:

$('#fileupload').fileupload({
    url: '/upload',
    dataType: 'json',
    done: function (e, data) {
        $.each(data.result.files, function (index, file) {
            $('<p/>').text(file.name).appendTo(document.body);
        });
    }
});

Dropzone:

Dropzone.options.myDropzone = {
    url: '/upload',
    init: function() {
        this.on("success", function(file, response) {
            console.log(file.name + " uploaded successfully");
        });
    }
};

Both libraries offer easy-to-use file upload functionality, but Dropzone provides a more modern approach with its standalone nature and extensive customization options. jQuery-File-Upload, while older, offers more comprehensive server-side integration examples and may be easier for beginners familiar with jQuery. The code comparison shows that Dropzone uses a more object-oriented approach, while jQuery-File-Upload relies on jQuery's plugin system. Ultimately, the choice between the two depends on project requirements, existing dependencies, and developer preferences.

28,920

The next open source file uploader for web browsers :dog:

Pros of Uppy

  • Modern, modular architecture with plugin system
  • Supports various upload sources (local, remote URLs, webcam)
  • Built-in progress UI and customizable themes

Cons of Uppy

  • Larger bundle size due to comprehensive feature set
  • Steeper learning curve for advanced configurations
  • May be overkill for simple upload scenarios

Code Comparison

jQuery-File-Upload:

$('#fileupload').fileupload({
    url: '/upload',
    dataType: 'json',
    done: function (e, data) {
        $.each(data.result.files, function (index, file) {
            $('<p/>').text(file.name).appendTo('#files');
        });
    }
});

Uppy:

const uppy = new Uppy()
  .use(Dashboard, { trigger: '#select-files' })
  .use(XHRUpload, { endpoint: '/upload' })

uppy.on('complete', (result) => {
  console.log('Upload complete! We've uploaded these files:', result.successful)
})

Summary

jQuery-File-Upload is a lightweight, jQuery-based solution ideal for simple upload tasks. It has a smaller footprint and easier integration for jQuery-based projects. Uppy, on the other hand, offers a more comprehensive, modern approach with extensive features and customization options. It's better suited for complex upload scenarios and projects not relying on jQuery. The choice between them depends on project requirements, desired features, and the existing tech stack.

15,052

🌊 A flexible and fun JavaScript file upload library

Pros of FilePond

  • Modern, lightweight, and highly customizable UI
  • Built-in image editing capabilities
  • Supports multiple file uploads with drag and drop

Cons of FilePond

  • Smaller community and fewer resources compared to jQuery-File-Upload
  • Less extensive browser support, focusing on modern browsers

Code Comparison

jQuery-File-Upload:

$('#fileupload').fileupload({
    url: '/upload',
    dataType: 'json',
    done: function (e, data) {
        $.each(data.result.files, function (index, file) {
            $('<p/>').text(file.name).appendTo('#files');
        });
    }
});

FilePond:

const inputElement = document.querySelector('input[type="file"]');
const pond = FilePond.create(inputElement, {
    server: '/api',
    labelIdle: 'Drop files here...',
    allowMultiple: true,
    allowImagePreview: true
});

Both libraries offer easy-to-use APIs for file uploads, but FilePond provides a more modern and customizable interface out of the box. jQuery-File-Upload has a larger community and more extensive documentation, making it easier to find solutions to common problems. FilePond excels in image handling and editing features, while jQuery-File-Upload offers broader browser support and more plugin options. The choice between the two depends on specific project requirements and target audience.

An enhanced HTML 5 file input for Bootstrap 5.x/4.x./3.x with file preview, multiple selection, and more features.

Pros of bootstrap-fileinput

  • More lightweight and focused on Bootstrap integration
  • Easier to set up and use for basic file upload needs
  • Better support for multiple themes and customization options

Cons of bootstrap-fileinput

  • Less comprehensive feature set compared to jQuery-File-Upload
  • May not handle large file uploads as efficiently
  • Limited server-side processing options

Code Comparison

bootstrap-fileinput:

$("#input-id").fileinput({
    uploadUrl: "/file-upload-batch/2",
    allowedFileExtensions: ['jpg', 'png', 'gif'],
    maxFileSize: 1000,
    maxFilesNum: 10,
});

jQuery-File-Upload:

$('#fileupload').fileupload({
    url: '/upload',
    dataType: 'json',
    done: function (e, data) {
        $.each(data.result.files, function (index, file) {
            $('<p/>').text(file.name).appendTo('#files');
        });
    }
});

Both libraries offer easy-to-use file upload functionality, but jQuery-File-Upload provides more advanced features and customization options. bootstrap-fileinput is more focused on Bootstrap integration and simplicity, making it a good choice for projects that prioritize ease of use and Bootstrap compatibility. jQuery-File-Upload is better suited for complex file upload requirements and projects that need extensive customization options.

2,959

A JavaScript library providing multiple simultaneous, stable, fault-tolerant and resumable/restartable file uploads via the HTML5 File API.

Pros of flow.js

  • Framework-agnostic and lightweight, making it more versatile for different project setups
  • Supports chunked uploads, allowing for better handling of large files and resumable uploads
  • More modern codebase with better TypeScript support

Cons of flow.js

  • Less comprehensive out-of-the-box features compared to jQuery-File-Upload
  • Smaller community and potentially less frequent updates
  • May require more setup and configuration for advanced use cases

Code Comparison

jQuery-File-Upload:

$('#fileupload').fileupload({
    url: '/upload',
    dataType: 'json',
    done: function (e, data) {
        $.each(data.result.files, function (index, file) {
            $('<p/>').text(file.name).appendTo(document.body);
        });
    }
});

flow.js:

var flow = new Flow({
    target: '/upload',
    chunkSize: 1024 * 1024
});
flow.assignBrowse(document.getElementById('fileupload'));
flow.on('fileSuccess', function(file, message){
    console.log(file.name + ' uploaded successfully.');
});

Both libraries provide easy-to-use APIs for file uploads, but flow.js offers a more modern approach with chunked uploads and better large file handling. jQuery-File-Upload has a more extensive feature set out-of-the-box, while flow.js focuses on core functionality and flexibility.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

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.

NPM DownloadsLast 30 Days