We advise to first read this short guide, and then optionally follow up with a framework specific guide.

FilePond works on all modern browsers and devices.

Quick Start

  1. Install the package

    We can install the filepond package using a package manager, load it from a cdn, or download the files manually.

    npm install filepond@beta
    pnpm add filepond@beta
    yarn add filepond@beta

    To load FilePond from a CDN we add the import map below to the top of our webpage.

    <script type="importmap">
        {
            "imports": {
                "filepond": "https://unpkg.com/filepond@beta/cdn/index.js",
                "filepond/": "https://unpkg.com/filepond@beta/cdn/"
            }
        }
    </script>

    To manually install FilePond we start by downloading the FilePond package below.

    filepond-5.0.0-beta.23.tgz

    After we unzip the package we copy the “esm” folder to our project and add the import map below to the top of our webpage.

    <script type="importmap">
        {
            "imports": {
                "filepond": "./path-to-file-pond-esm/index.js",
                "filepond/": "./path-to-file-pond-esm/"
            }
        }
    </script>
  2. Add the custom element

    Let’s assume we already have a <input type="file"> on our page, to add FilePond we wrap it with our new <file-pond> custom element.

    <form action="/upload" method="POST">
        <label for="my-file">Document</label>
        <file-pond>
            <input id="my-file" type="file" name="files" multiple required />
        </file-pond>
    
        <button type="submit">Upload</button>
    </form>

    Nothing happens because we have yet to register the <file-pond> custom element so the browser knows how to deal with it.

  3. Register the custom element

    We register the <file-pond> custom element using the defineFilePond function.

    Let’s import both the function and the English locale, then we call defineFilePond to register the <file-pond> custom element and pass the imported locale to set our default locale.

    <form action="/upload" method="POST">
        <label for="my-file">Document</label>
        <file-pond>
            <input id="my-file" type="file" name="files" multiple required />
        </file-pond>
    
        <button type="submit">Upload</button>
    </form>
    
    <script type="module">
        import { defineFilePond } from 'filepond';
        import { locale } from 'filepond/locales/en-gb.js';
    
        defineFilePond({
            locale,
        });
    </script>

    We’re done! After refreshing the page FilePond will have replaced the <input type="file"> and the for attribute of our <label> will point to the <file-pond> element.

    Tap the “Run now” button above to open this example as a demo demo.

Importing the package

Because most web projects these days use a framework or a bundler like Vite the code examples in the documentation import FilePond like a node module.

import { defineFilePond } from 'filepond';

To import FilePond exports without a bundler we have to either use a relative path './filepond/esm/index.js', or we have to set up an import map to import the package.

-import { defineFilePond } from 'filepond';
+import { defineFilePond } from './filepond/esm/index.js';

The import map below redirects the 'filepond' module name to ./filepond/esm/index.js and redirects module paths starting with 'filepond/' to ./filepond/esm/.

<script type="importmap">
    {
        "imports": {
            "filepond": "./filepond/esm/index.js",
            "filepond/": "./filepond/esm/"
        }
    }
</script>

Content Security Policy

If a Content Security Policy (CSP) is present on your website or app we most likely have to update it.

The directives below cover all FilePonds configurations. See below explanation if you want to pick and choose based on your FilePond configuration. Please note that the worker-src directive is optional.

img-src 'self' blob: data:;
media-src 'self' blob:;
worker-src 'self' blob:;

Next steps