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.
<div class="sl-upload" data-sl-upload data-types="image/png,image/jpeg,application/pdf" data-max-mb="5" data-max-files="6">
<input class="visually-hidden" type="file" id="upFiles" multiple accept=".png,.jpg,.jpeg,.pdf">
<label class="sl-upload-zone" for="upFiles">
<span class="sl-upload-icon" aria-hidden="true"><i class="ti ti-cloud-upload"></i></span>
<strong>Drop files here or <span class="sl-upload-browse">browse</span></strong>
<small>PNG, JPG or PDF · up to 5 MB each · 6 files max</small>
</label>
<ul class="sl-upload-list"></ul>
</div> <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
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' }
});