Convert Figma logo to code with AI

pqina logofilepond

🌊 A flexible and fun JavaScript file upload library

15,052
821
15,052
125

Top Related Projects

29,388

Reorderable drag-and-drop lists for modern browsers and touch devices. No jQuery or framework required.

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.

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.

28,920

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

18,054

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

It's a new file uploader solution!

Quick Overview

FilePond is a JavaScript library for building beautiful, accessible, and interactive file upload components. It offers a smooth user experience, customizable UI, and supports features like image previews, drag and drop, and server-side processing.

Pros

  • Highly customizable with a wide range of plugins and API options
  • Responsive design that works well on both desktop and mobile devices
  • Excellent browser support, including older versions of Internet Explorer
  • Lightweight core with modular architecture for adding only needed features

Cons

  • Learning curve can be steep for advanced customizations
  • Some features require additional plugins, which may increase bundle size
  • Limited built-in server-side integrations, requiring custom backend implementations
  • Documentation can be overwhelming for beginners due to the large number of options

Code Examples

Basic file upload setup:

import * as FilePond from 'filepond';

const inputElement = document.querySelector('input[type="file"]');
const pond = FilePond.create(inputElement);

Adding image preview functionality:

import * as FilePond from 'filepond';
import FilePondPluginImagePreview from 'filepond-plugin-image-preview';

FilePond.registerPlugin(FilePondPluginImagePreview);

const pond = FilePond.create(document.querySelector('input[type="file"]'), {
  allowMultiple: true,
  allowImagePreview: true,
  maxFiles: 3
});

Handling server-side uploads:

const pond = FilePond.create(document.querySelector('input[type="file"]'), {
  server: {
    url: 'https://your-server.com/upload',
    process: {
      onload: (response) => {
        console.log('File uploaded successfully', response);
      },
      onerror: (response) => {
        console.error('Error uploading file', response);
      }
    }
  }
});

Getting Started

  1. Install FilePond:

    npm install filepond
    
  2. Import and initialize FilePond in your JavaScript file:

    import * as FilePond from 'filepond';
    import 'filepond/dist/filepond.min.css';
    
    const inputElement = document.querySelector('input[type="file"]');
    const pond = FilePond.create(inputElement, {
      labelIdle: 'Drag & Drop your files or <span class="filepond--label-action">Browse</span>',
      allowMultiple: true,
      maxFiles: 5
    });
    
  3. Add the file input element to your HTML:

    <input type="file" class="filepond">
    

This basic setup creates a FilePond instance with drag and drop functionality, multiple file uploads, and a limit of 5 files. Customize further by exploring the extensive API and plugin options available in the FilePond documentation.

Competitor Comparisons

29,388

Reorderable drag-and-drop lists for modern browsers and touch devices. No jQuery or framework required.

Pros of Sortable

  • More versatile, allowing for sorting of various elements beyond just file uploads
  • Supports nested sortable lists and multiple connected lists
  • Extensive API with numerous options for customization

Cons of Sortable

  • Lacks built-in file upload functionality
  • May require more setup and configuration for complex use cases
  • Less focused on providing a polished, out-of-the-box file upload experience

Code Comparison

Sortable:

new Sortable(document.getElementById('list'), {
  animation: 150,
  ghostClass: 'blue-background-class'
});

FilePond:

FilePond.create(document.querySelector('input[type="file"]'), {
  allowMultiple: true,
  maxFiles: 3,
  instantUpload: false
});

Key Differences

FilePond is specifically designed for file uploads, offering a streamlined and visually appealing interface with built-in features like image previews and drag-and-drop functionality. Sortable, on the other hand, is a more general-purpose library for creating sortable lists and grids, which can be applied to various types of content beyond just files.

While Sortable provides greater flexibility for creating draggable and sortable interfaces, FilePond offers a more focused and polished solution for handling file uploads with less configuration required. The choice between the two depends on the specific needs of the project and whether a dedicated file upload solution or a more versatile sorting library is required.

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 mature project with a longer history and larger community
  • Offers a wider range of features, including drag-and-drop, chunking, and resume functionality
  • Supports multiple UI frameworks (jQuery, React, Angular)

Cons of Fine Uploader

  • Larger file size and potentially more complex setup
  • Less modern UI design compared to FilePond
  • Not as actively maintained in recent years

Code Comparison

Fine Uploader (JavaScript):

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

FilePond (JavaScript):

const inputElement = document.querySelector('input[type="file"]');
const pond = FilePond.create(inputElement, {
    server: '/api'
});

Both libraries offer easy-to-use APIs for file uploading, but FilePond's modern approach and simpler setup may be more appealing for newer projects. Fine Uploader provides more advanced features out of the box, which could be beneficial for complex use cases. FilePond's smaller size and active development make it a strong contender for lightweight, modern applications, while Fine Uploader's maturity and extensive feature set cater to more demanding enterprise needs.

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.

Pros of jQuery-File-Upload

  • More mature and battle-tested, with a longer history of development and use
  • Offers a wider range of features and customization options out-of-the-box
  • Supports a broader range of server-side implementations and integrations

Cons of jQuery-File-Upload

  • Depends on jQuery, which may not be ideal for modern web applications
  • Has a larger footprint and may impact page load times
  • Less modern UI and user experience compared to FilePond

Code Comparison

FilePond:

import * as FilePond from 'filepond';

const pond = FilePond.create({
  name: 'filepond',
  multiple: true,
  allowMultiple: true
});

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);
    });
  }
});

Both libraries offer easy-to-use APIs for file uploads, but FilePond has a more modern and concise syntax. jQuery-File-Upload relies on jQuery's syntax and callbacks, while FilePond uses a more contemporary approach with promises and modern JavaScript features.

28,920

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

Pros of Uppy

  • More comprehensive file upload solution with support for various sources (local, remote URLs, cloud services)
  • Extensible plugin architecture allowing for easy customization and feature addition
  • Built-in support for image cropping, compression, and preview generation

Cons of Uppy

  • Larger file size and potentially higher overhead due to its extensive feature set
  • Steeper learning curve for developers due to its more complex API and configuration options
  • May be overkill for simple upload scenarios where a lightweight solution would suffice

Code Comparison

Uppy initialization:

const uppy = new Uppy()
  .use(Dashboard, { inline: true, target: '#drag-drop-area' })
  .use(Tus, { endpoint: 'https://tusd.tusdemo.net/files/' })

FilePond initialization:

const pond = FilePond.create({
  name: 'filepond',
  server: '/api'
});
document.body.appendChild(pond.element);

Both Uppy and FilePond offer modern file upload solutions, but they cater to different needs. Uppy provides a feature-rich, highly customizable experience suitable for complex upload scenarios, while FilePond focuses on simplicity and ease of use for more straightforward implementations. The choice between the two depends on the specific requirements of your project and the level of customization needed.

18,054

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

Pros of Dropzone

  • More mature and established project with a larger community
  • Extensive documentation and examples available
  • Built-in support for image previews and thumbnail generation

Cons of Dropzone

  • Larger file size and potentially heavier on resources
  • Less modern UI design out of the box
  • More complex configuration for advanced features

Code Comparison

Dropzone initialization:

Dropzone.options.myDropzone = {
  url: "/file/post",
  maxFilesize: 2,
  acceptedFiles: ".jpeg,.jpg,.png,.gif"
};

FilePond initialization:

FilePond.create(document.querySelector('input[type="file"]'), {
  server: '/api',
  allowMultiple: true,
  maxFiles: 3
});

Both libraries offer easy setup and configuration, but FilePond's API tends to be more intuitive and modern. Dropzone provides more granular control over file uploads, while FilePond focuses on a streamlined, user-friendly experience.

FilePond excels in its responsive design and customizable UI, making it a great choice for projects prioritizing aesthetics and user experience. Dropzone, on the other hand, offers robust functionality and is well-suited for complex file upload requirements.

Ultimately, the choice between these two libraries depends on project-specific needs, such as desired features, performance requirements, and target audience.

It's a new file uploader solution!

Pros of WebUploader

  • More comprehensive feature set, including chunked uploads and server-side integration
  • Better support for older browsers, including IE6+
  • Extensive Chinese documentation, beneficial for Chinese-speaking developers

Cons of WebUploader

  • Less active development and maintenance compared to FilePond
  • Larger file size and potentially heavier performance impact
  • Less modern and intuitive user interface

Code Comparison

WebUploader:

var uploader = WebUploader.create({
    pick: '#filePicker',
    server: '/upload.php',
    accept: {
        title: 'Images',
        extensions: 'gif,jpg,jpeg,bmp,png'
    }
});

FilePond:

const pond = FilePond.create({
    name: 'filepond',
    acceptedFileTypes: ['image/*'],
    server: '/upload'
});
document.body.appendChild(pond.element);

Both libraries offer easy setup, but FilePond's API is more concise and modern. WebUploader provides more granular control over file types, while FilePond uses a simpler MIME type approach. WebUploader's configuration is more verbose, which can be beneficial for complex setups but may be overkill for simpler use cases. FilePond's API is more intuitive for developers familiar with modern JavaScript practices.

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

FilePond

A JavaScript library that can upload anything you throw at it, optimizes images for faster uploads, and offers a great, accessible, silky smooth user experience.

License: MIT npm version npm minzipped size

FilePond adapters are available for React, Vue, Angular, Svelte, and jQuery


FilePond

Buy me a Coffee / Use FilePond with Pintura / Dev updates on Twitter


Core Features

  • Accepts directories, files, blobs, local URLs, remote URLs and Data URIs.
  • Drop files, select on filesystem, copy and paste files, or add files using the API.
  • Async uploads with AJAX, supports chunk uploads, can encode files as base64 data and send along form post.
  • Accessible, tested with AT software like VoiceOver and JAWS, navigable by Keyboard.
  • Image optimization, automatic image resizing, cropping, filtering, and fixes EXIF orientation.
  • Responsive, automatically scales to available space, is functional on both mobile and desktop devices.

Learn more about FilePond


Also need Image Editing?

Pintura the modern JavaScript Image Editor is what you're looking for. Pintura supports setting crop aspect ratios, resizing, rotating, cropping, and flipping images. Above all, it integrates beautifully with FilePond.

Learn more about Pintura


FilePond Plugins

Adapters

Backend

Quick Start

Install using npm:

npm install filepond

Then import in your project:

import * as FilePond from 'filepond';

// Create a multi file upload component
const pond = FilePond.create({
    multiple: true,
    name: 'filepond'
});

// Add it to the DOM
document.body.appendChild(pond.element);

Or get it from a CDN:

<!DOCTYPE html>
<html>
<head>
  <title>FilePond from CDN</title>

  <!-- Filepond stylesheet -->
  <link href="https://unpkg.com/filepond/dist/filepond.css" rel="stylesheet">

</head>
<body>

  <!-- We'll transform this input into a pond -->
  <input type="file" class="filepond">

  <!-- Load FilePond library -->
  <script src="https://unpkg.com/filepond/dist/filepond.js"></script>

  <!-- Turn all file input elements into ponds -->
  <script>
  FilePond.parse(document.body);
  </script>

</body>
</html>

Getting started with FilePond

Internationalization

The locale folder contains different language files, PR's are welcome, you can use locale files like this:

import pt_BR from 'filepond/locale/pt-br.js';

FilePond.setOptions(pt_BR);

Contributing

At the moment test coverage is not great, it's around 65%. To accept pull requests the tests need to be better, any help to improve them is very much appreciated.

Tests are based on Jest and can be run with npm run test

To build the library run npm run build

Publications

Browser Compatibility

FilePond is compatible with a wide range of desktop and mobile browsers, the oldest explicitly supported browser is IE11, for best cross browser support add FilePond Polyfill and Babel polyfill to your project.

FilePond uses BrowserStack for compatibility testing.

BrowserStack

License

Please don't remove or change the disclaimers in the source files

MIT License

Copyright (c) 2020 PQINA | Rik Schennink

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

NPM DownloadsLast 30 Days