Search
Enter at least two characters without personal information.

    LibraryArticles & FAQ Your projectRequest a quote
    LanguageEN
    Practical guides

    Prepare useful, controlled website file uploads

    An attachment introduces an entire journey: selection, transfer, checking, viewing and deletion. It needs a precise purpose and an identified person able to operate the workflow.

    Go to the method

    External drive, folder and upload interface on a tablet
    AI-generated illustration

    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.

    Match each upload check to its limits
    Situation or settingWhat it meansUseful check
    Extension and declared typeThey help filter intended formats.Client-supplied names and types can be misleading; also inspect content on the server.
    File size and countThey bound usage and resource consumption.Check actual receiving limits, including interrupted or repeated submissions.
    Storage name and accessA 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.

    Boundary cases for fictional PDF-only uploads
    TestVerified size or contentExpected result under this contract
    PDF A1 999 999 bytesReceipt allowed; analysis still required
    PDF B2 000 000 bytesReceipt allowed at the limit; analysis still required
    PDF C2 000 001 bytesRejected: per-file limit exceeded
    Document claiming to be PDFHTML content detectedType rejected; no public availability

    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

    Content updated on

    Acceptance matrix to adapt to your project

    These proposed checks use synthetic cases. Decide the required behaviour with the team, record the result and assign unresolved gaps before release.

    Scroll the table horizontally to read every column. With a keyboard, focus the table area and use the arrow keys.

    Test cases, expected outcomes and useful evidence
    CaseExpected outcomeEvidence to retain
    Allowed fileReceipt and advertised status match the file actually processed.Identifiable synthetic file, actual received size, server status and outcome shown to the user.
    Refused type or sizeThe server refuses the file and the form permits correction.Server result and accessible message presented to the person submitting the file.
    Unexpected filename charactersThe name does not select a storage destination or command.Original name, assigned storage name and check in an isolated environment.
    Interrupted or repeated uploadStatus never claims completion without a complete received file.Network sequence and items actually retained after both controlled attempts.

    Frequently asked questions

    Which upload checks go beyond the browser file picker?

    In an authorised environment, check server-side size, allowed types, naming, access and processing, including when interface checks are bypassed. Include an empty file, a rejected file and an interrupted transfer. Distinguish receipt, pending analysis and rejection. A client-declared type or extension does not establish the actual content.

    How can you avoid multiplying copies of an uploaded document?

    Describe the actual path: receipt, storage, notification, viewing and planned deletion. Identify purpose, access and owner for each copy. A notification can announce availability without attaching the document to several mailboxes. Test viewing with an unauthorised account and access removal when the case closes.