filepond README

The project's README from github.com/pqina/filepond. As one markdown file: README.md.

FilePond

License: MIT npm version npm Discord

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.

Installing FilePond

Install the filepond package by running the following command in your terminal:

npm install filepond

Quick Start

Wrap an <input type="file"> with the <file-pond> custom element and then register the custom element using the defineFilePond function.

Getting started

<form action="/upload" method="POST">
    <label for="my-file">Files</label>
    <file-pond>
        <input id="my-file" type="file" name="files" required />
    </file-pond>

    <button type="submit">Upload</button>
</form>

<script type="module">
    import { defineFilePond } from 'filepond';
    import { locale } from 'filepond/locales/en-gb.js';

    const elements = defineFilePond({
        locale,
    });
</script>

Integrating FilePond With a Framework

When integrating with a framework like React, Svelte, Vue, or Angular we can use the <file-pond> custom element as if it were a Component.

Framework integration

import { useState } from 'react';

// FilePond imports
import { defineFilePond, type FilePondEntrySource, type FilePondElement } from 'filepond';
import { locale } from 'filepond/locales/en-gb.js';

// Optionally import React <file-pond> component types
import 'filepond/types/react';

// Define <file-pond> element and sets English locale
defineFilePond({
    locale,
});

export default function App() {
    // two-way data binding
    const [entries, setEntries] = useState<FilePondEntrySource[]>([
        new File(['hello'], 'world.txt', {
            type: 'text/plain',
        }),
    ]);

    // handle form submit
    function handleSubmit(e: React.SyntheticEvent<HTMLFormElement>) {
        e.preventDefault();

        console.log('submit', e);
    }

    return (
        <form onSubmit={handleSubmit} method="POST">
            <label htmlFor="my-files">Documents</label>
            <file-pond
                onentrieschange={({ detail: currentEntries }) => {
                    setEntries(currentEntries);
                }}
                entries={entries}
            >
                <input id="my-files" name="my-files" type="file" required multiple />
            </file-pond>

            <button type="submit">Sumbit</button>
        </form>
    );
}

License

MIT

filepond (pqina/filepond)

Searching Database…

What is this?FilePond is a JavaScript file upload library that handles drag-and-drop, file selection, and async uploads while automatically optimizing images (resize, crop, filter, EXIF fix) for a smooth, accessible upload experience.
Is it a standalone library or does it need a framework?It's a vanilla JavaScript library at its core, with official adapters that wrap it for React, Vue, Angular, Svelte, and jQuery projects.
How do I add it to a project?Install it with npm and import it into your code, or pull it in directly from a CDN script tag.
Do I need a specific backend to receive the uploads?No particular backend is required, but the community maintains ready-made server integrations for PHP, Django, Laravel, SilverStripe, and Ruby on Rails to handle the upload endpoint.
How solid and well-tested is FilePond right now?Test coverage is only around 65% by the maintainer's own admission, and if you need to support IE11 or other old browsers you must add the separate FilePond Polyfill and Babel polyfill yourself.
What image handling does FilePond do automatically?It auto-resizes, crops, filters images, and fixes EXIF orientation on the fly before upload, so images arrive optimized without extra code.
Can I edit images before uploading, like crop or rotate?FilePond itself focuses on upload UX, but it integrates with Pintura, the author's separate JavaScript image editor, to add crop, rotate, resize, and flip tools.
What plugins can extend FilePond's behavior?There are official plugins for file encode, rename, size/type validation, metadata, poster images, and image preview, crop, resize, filter, and transform, plus several community plugins for things like PDF preview and zip uploads.
How are files actually sent to the server?FilePond uploads asynchronously over AJAX, supports chunked uploads for large files, and can also encode files as base64 or send them along with a normal form post.
Creator
pqina
Size
9.5 MB
Stars
16.4K
Age
9y
Commits · 90 Days