Estimated reading time : 4 min · Published
Justify the request and show limits
Explain which document is needed and what decision it supports. Consider simple fields if they can achieve the same result. Before selection, state formats, count and size limits and an alternative for unsuitable documents.
Do not require unnecessary personal information. Use synthetic files for acceptance testing. Separate publication approval from receipt: receiving a photograph does not automatically establish permission to publish it.
Check content on the server
OWASP describes complementary controls including allowed formats, type validation, controlled storage names, limits and protected storage. A browser-supplied type alone does not establish file content. Interface checks supplement rather than replace server checks.
Have the software owner review processing. Define handling for files requiring analysis, damaged documents and rejected content. A scan or recognised extension should not be presented as an absolute safety guarantee.
Scroll the table horizontally to read every column. With a keyboard, focus the table area and use the arrow keys.
| Situation or setting | What it means | Useful check |
|---|---|---|
| Extension and declared type | They help filter intended formats. | Client-supplied names and types can be misleading; also inspect content on the server. |
| File size and count | They bound usage and resource consumption. | Check actual receiving limits, including interrupted or repeated submissions. |
| Storage name and access | A generated name and isolated storage reduce some risks. | Check permissions and file processing separately; no single control is sufficient. |
Test the journey to its recipient
Try an allowed file, oversized file, rejected format, accented name and interrupted transfer. Verify that users understand acceptance and required corrections. Do not display success when transfer has not completed.
Check arrival in the correct work queue and access by an authorised person. Also test a different account and a direct download address. The file should remain inaccessible to someone without the service’s required permissions.
Fictional contract: PDF files only, at most 3 files and 2 000 000 bytes per file, inclusive. This is a decimal unit, not 2 MiB. Try sizes immediately below, at and above the limit, using valid PDFs for the first three cases. A .pdf extension and a declared Content-Type are insufficient: the fourth test contains HTML despite claiming to be a PDF.
Three files at the limit contain 3 × 2 000 000 = 6 000 000 bytes of documents, but a multipart request adds headers and boundaries. Distinguish per-file size, attachment count and request-size ceilings, checking both proxy and application. Four small PDFs must fail the count rule even if their combined size is below that ceiling. Here permitted receipt places the document in a pending-analysis state; it neither publishes it nor declares it harmless.
Scroll the table horizontally to read every column. With a keyboard, focus the table area and use the arrow keys.
| Test | Verified size or content | Expected result under this contract |
|---|---|---|
| PDF A | 1 999 999 bytes | Receipt allowed; analysis still required |
| PDF B | 2 000 000 bytes | Receipt allowed at the limit; analysis still required |
| PDF C | 2 000 001 bytes | Rejected: per-file limit exceeded |
| Document claiming to be PDF | HTML content detected | Type rejected; no public availability |
- OWASP : File Upload Cheat Sheet
OWASP, consulted 22 October 2026: complementary file checks. The numerical limits and tests are fictional.
Manage storage and deletion
Document storage, access, backups and retention justified by the need and applicable context. Arrange removal of abandoned temporary files as well as processed documents. Notifications can point to secure storage instead of copying every attachment to multiple inboxes.
Repeat boundary tests after form changes and check historical files. Deliver allowed formats, understandable errors, a permissions matrix and an owner-assigned deletion procedure.
Primary documentation : OWASP : File Upload Cheat Sheet.
Offer file selection without dropping and explicit order
Provide a file-selection control alongside a drop area. For reordering, offer Move up, Move down or destination selection without dragging. Check focus and the order actually submitted after each change.
Distinguish selected file, completed transfer and accepted document. A finished progress bar is insufficient when the server still validates the file. Explain recovery after rejection without removing other accepted documents.
Reorder items without relying on drag and drop · Choose interface links, buttons and actions · Write and announce interface status messages
Reference documents
- OWASP : File Upload Cheat Sheet · Source consulted
Content updated on
