Feature Library

File drop and upload list

0.04 CPU ms
A still of the File drop and upload list demo
Still
The live demo starts when it’s in view.Drop files or a folder on the zone, choose them, or paste · ↑ ↓ move through the list, Delete removes · nothing leaves your browser

A drop zone with a real button, folders walked, paste from the clipboard, and checks by type, size, count and duplicates (by content.

What it costs a frame

0.04 ms
GPU
not used
CPU, median
0.04 ms
CPU, 95th pct
0.09 ms
Draw calls
0
Weight
Light

Measured 11 November 2026 on 13th Gen Intel(R) Core(TM) i9-13900H, Chrome 157, 1920×1080 at 1×. 600 frames × 3 rounds, median kept. What ran: Measured with the demo exercising itself: 40 files (eight of them pictures with thumbnails) added every 240 frames and uploaded by the simulated uploader, three at a time, with the list cleared before each batch, while the list scrolls 3 px a frame. Each frame writes only the rows that changed (progress, status) and the summary, in one batch. Nothing runs between changes. Phones: tiers are being measured next.

On every machine it was measured on
MachineGPU msCPU msCPU p95
unknown GPU · 13th Gen Intel(R) Core(TM) i9-13900Hreference · measuring toolnot timed0.040.09
apple · Apple A19 Proin a browser tab · 16 November 2026not timed0.304.74
Intel Arc 140V (Xe2-LPG) · Intel Core Ultra 7 258Vin a browser tab · 15 November 2026not timed0.060.10

Bars against one 16.7 ms frame. A browser-tab run is timed in a visible tab without the tool’s scripted input, so read it as close, not exact.

What it needs

Renders with
DOM and CSSPlain DOM and CSS: every current browser.
Your browser
Runs hereNo WebGPU needed
Depends on
NothingNo other packages

What it’s for

  1. Attachments in a form or a message
  2. Uploading photos and documents
  3. Importing a folder of assets
  4. Avatar and single-file fields
  5. Pasting screenshots
  6. Bulk uploads with retry
  7. Catching the same file sent twice under another name

Pitfalls, in brief

  1. Checks in the browser are a courtesy, not security: a file’s type comes from its name, and anyone can send anything to your URL.
  2. Read a drop inside the drop handler: the browser empties the DataTransfer when the handler returns. filesFromDrop takes every entry at once and reads the folders afterwards; call it before any await.
  3. A dropped folder is read in batches (readEntries gives 100 at a time in Chrome), and a big one takes a moment: the limit option (10,000) stops a dropped home folder from hanging the page.
  4. browse() and the file chooser open only during a click or a key press: browsers block them from timers, promises and page load.
  5. guardPage stops a file dropped beside the zone from opening in the tab and leaving your app.
9 more in brief
  1. Sizes are in powers of 1000, as most systems show them: give maxSize as 10e6 to read "10 MB".
  2. fetch can’t report upload progress in most browsers yet: httpUploader uses XMLHttpRequest for that.
  3. Thumbnails are cut from the picture’s width: a very wide panorama comes out soft.
  4. Firefox and Safari without folder support hand a folder over as an empty file with no type; the rules turn it away as empty (minSize 1).
  5. Duplicates by content read every file the rules take before it is listed: small ones go to crypto.subtle whole (it can’t be fed in pieces), bigger ones (whole, 8 MB) are hashed in 1 MiB slices with a pause between, a few milliseconds of script each.
  6. crypto.subtle exists only in secure contexts (https and localhost): a page on plain http over the LAN has none, and the sliced SHA-256 does all the hashing there.
  7. add() resolves once its batch is checked and listed (it used to return at once); batches go one after another so each sees the one before. onAdd and onReject may come in parts while a big batch is read: rows show as soon as they and every file before them are known.
  8. A hash in the browser is a courtesy too: the server can’t trust it.
  9. With name set, the hidden input carries the files only where the DataTransfer constructor exists (every current engine); otherwise read value and append the files to your FormData yourself.
14 pitfalls in full, the hook-up guide, the module source and its tests come with the part.

Where it comes from

Written for the library. Fully custom code.

WAI-ARIA Authoring Practices Guide (W3C): a native button with a labelled group for the drop region, progressbar roles, roving tabindex in the list (as in the toolbar pattern), and announcements through a polite live region. Written here from scratch.

FIPS 180-4, Secure Hash Standard (NIST): SHA-256 as specified, written here from the standard for hashing in slices; checked against its test vectors and node:crypto

WHATWG HTML: the accept attribute and drag and drop: how accept tokens (extensions, MIME types, type/*) are matched, and when a drag’s DataTransfer can be read

file uploaddrag and dropdrop zonefolderspastevalidationduplicatessha-256content hashcrypto.subtleprogressthumbnailscreateImageBitmapIntersectionObserverXMLHttpRequestlive regionaccessibilitykeyboardtouchrtldomcssno dependencies

Near it in the frame