File Upload

qds-file-upload selects real browser files and optionally coordinates an application-owned upload handler. It includes a native picker, optional dropzone, named file actions, metadata validation and cancellable progress/error/retry states.

Standalone import

<script type="module" src="/assets/components/file-upload/qds-file-upload.js"></script>
<qds-file-upload label="Diligence attachments" name="attachments" multiple
  accept=".pdf,.xlsx,image/*" max-size="10485760" max-files="5"
  hint="Choose up to five files, each no larger than 10 MiB."></qds-file-upload>

See the complete interactive demo for selection, forms, transfer, error/retry, readonly/disabled and composition examples.

File values and validation

Native forms

name submits each selected File as a repeated FormData entry. form supports an external native form. The browser validates the field before ordinary form submission; manually calling new FormData(form) does not run validation.

checkValidity() leaves focus in place. Native invalid submission and repeated component/form reportValidity() focus the visible chooser while preserving its caption and selected File values. Canceling invalid suppresses native validation focus. The internal picker adds no Tab stop. Error text uses the normal text token with an error-colored border so it remains readable in both themes.

Native reset clears selection and cancels work without input/change events. Browser restoration accepts real File/FormData state, restores queued files silently, and never starts transport automatically. Fake paths and string restore values are ignored.

const uploader = document.querySelector('qds-file-upload');
uploader.addEventListener('change', ({ detail }) => {
  console.log(detail.files); // actual File objects, not paths or JSON
});

Custom transport

uploader.uploadHandler = async (file, { signal, onProgress }) => {
  // Your transport owns endpoint, authentication, persistence and policy.
  const result = await applicationUpload(file, { signal, onProgress });
  return result;
};
await uploader.upload();

Events and accessibility

Quangular

Generated QdsFileUploadComponent supports File[] reactive forms and direct bindings while preserving actual File identity. It exposes typed transport/selection events and public choose/upload/cancel/retry/removeFile/clear/focus/validation methods. Task snapshots remain readonly native state. Documents uses these generated bindings to prepare local diligence evidence for an opportunity, show progress/error/cancel/retry, and display a completed local attachment with an opportunity link. Pending files clear on context changes; attachments reset on navigation/reload. File contents stay in the browser.