Direct-to-S3 / Azure tus 1.0 resume IndexedDB Golden Retriever 30 locales Webcam & screen capture

File Extension Validation

Restrict uploads to specific file types using the asp-extensions attribute. Files that do not match the allowed extensions are rejected immediately on the client side before any upload begins.

What you should see: only .jpg/.png/.gif/.webp are accepted, up to 5 MB. Choose a .pdf and it is refused immediately, before any request is made.

Images Only (.jpg, .png, .gif, .webp)

Drag & drop files here, or paste from clipboard

Documents Only (.pdf, .doc, .docx, .xls, .xlsx)

Drag & drop files here, or paste from clipboard
<!-- Images only -->
<core-upload asp-upload-url="/api/upload/upload"
 asp-extensions=".jpg,.png,.gif,.webp"
 asp-max-size="5MB"
 asp-button-text="Select Images">
</core-upload> 
<!-- Documents only -->
<core-upload asp-upload-url="/api/upload/upload"
 asp-extensions=".pdf,.doc,.docx,.xls,.xlsx"
 asp-max-size="20MB"
 asp-button-text="Select Documents">
</core-upload>

The list the component enforces

asp-extensions rejects files that do not match before any transfer starts, and also supplies the file dialog's filter, so the picker and the rule agree without you writing the list twice.

Allow-list, never deny-list

Enumerating what you accept is finite and reviewable. Enumerating what you reject is a race you lose — there is always another extension, another double extension, another platform's executable format. If the answer is “images and PDFs”, say exactly that.

The server has to repeat the check. An extension is part of a file name, which is to say it is a claim rather than a fact.