ID

File upload

Drag & drop or browse, with previews, progress and clear errors — Selaras’ own uploader (no library) or FilePond.

FilePond 4.32 · MIT

Selaras uploader No library

A real file input sits under the drop zone, so it works with the keyboard and screen readers: Tab to it and press Enter or Space. Wrong types and oversized files are rejected with a reason. Uploading is simulated here — swap the upload() function for your own request.

    HTML — include once, after selaras.js; every [data-sl-upload] is set up
    <script src="assets/js/sl-upload.js"></script>

    FilePond

    A polished uploader with image previews and drag-to-reorder. Selaras restyles it with its tokens. The process function below fakes the upload — point FilePond's server option at your endpoint instead.

    Project files

    JavaScript
    FilePond.registerPlugin(FilePondPluginImagePreview, FilePondPluginFileValidateType, FilePondPluginFileValidateSize);
    FilePond.create(document.querySelector('#fpFiles'), {
      allowMultiple: true,
      maxFiles: 6,
      maxFileSize: '5MB',
      acceptedFileTypes: ['image/png', 'image/jpeg', 'application/pdf'],
      labelIdle: 'Drop files here or <span class="filepond--label-action">browse</span>',
      credits: false,
      server: { process: fakeUpload }   // replace with { url: '/api/upload' }
    });