~/qa-guides

~/qa-guides/file-upload-testing-checklist

>_ File Upload Testing Checklist: Test Cases and Examples

A detailed file upload checklist with ten worked test cases for validation, interrupted transfers, processing, private access, attachment saving, and replacement.

File uploadsValidationAPI testingTest cases

Published

Short answer

A file upload testing checklist verifies that users can select an allowed file, transfer it, complete any processing, and save it against the correct record. It also checks rejection, interruption, retry, access, replacement, and cleanup so a successful progress bar does not hide an unusable or incorrectly exposed attachment.

Test the visible interface and the service that accepts or attaches the file. Verify the resulting file identity, content, owner, status, and record association. A filename appearing in the form is not enough evidence that the upload workflow completed.

This guide provides a full checklist and ten worked file upload test cases using one explicit example contract. Adapt those expectations to your product rather than assuming every uploader has the same limits, processing states, or retry behavior.

Define the upload contract and test data

Example rules used by the worked cases

The examples describe private attachments on a support ticket:

  • Allowed formats are PDF and PNG; file contents must match the accepted format.
  • Each file must be nonempty and no larger than 5 MiB, inclusive: 5,242,880 bytes.
  • A saved ticket may have at most three attachments with a combined size no larger than 10 MiB: 10,485,760 bytes.
  • Files transfer independently into staging. A failed file does not discard other successfully uploaded files.
  • A transferred file remains processing until checks succeed. Only ready files can be attached or downloaded; rejected or failed files cannot.
  • The uploader may access their own ready staged files. After attachment, only the ticket owner may read them in this example.
  • Retrying the same logical upload with the same retry token and contents returns the same staged file ID during a 24-hour retry window.
  • A failed ticket save changes no saved attachment associations. Ready staged files remain available for correction and retry within their staging lifetime.
  • Cancelled, abandoned, rejected, and deleted file data is removed within 24 hours after entering that condition. Cancellation or deletion blocks application access immediately.
  • Replacement commits the new attachment and marks the old file deleted together; a failed replacement preserves the original attachment.

These are example product requirements, including the 24-hour windows. Record your actual retention, retry, and replacement rules before executing equivalent tests. Use two isolated test accounts, A and B, and tickets owned by each.

Prepare fixtures that isolate one rule

Keep a small valid PDF and PNG, a zero-byte file, a harmless text file, a damaged PNG, and valid documents near the size limit. Record each fixture's exact byte count and an identifying piece of content, such as a visible reference number.

A file named report.pdf is not necessarily a valid PDF. Size fixtures must remain parseable documents; do not create a boundary fixture by arbitrarily truncating a file and then attribute a parser rejection to its size.

For the combined-size example, prepare valid PDFs of 5,242,880, 4,194,304, and 1,048,576 bytes. Their sum is exactly 10,485,760 bytes. A separate valid third PDF of 1,048,577 bytes makes the total one byte too large while staying below the individual-file limit.

For the surrounding required fields, validation messages, and form submission behavior, use the Form Testing Checklist. This guide follows the file itself through transfer, processing, attachment, and removal.

When an uploaded CSV creates or updates application records, use the CSV Import Testing Checklist to verify parsing, mapping, duplicate rules, row outcomes, and saved data.

Quick file upload testing checklist

  • Upload one allowed file, save the record, reload it, and retrieve the intended content.
  • Verify files exactly at and one byte above the stated individual size limit.
  • Submit an unsupported file directly to the service and confirm rejection.
  • Check a harmless file whose extension does not match its contents.
  • Exercise the attachment-count and combined-size limits independently.
  • Interrupt a transfer and verify that retry follows the documented duplicate-handling rule.
  • Cancel an upload and confirm that it cannot become an attachment later.
  • Hold processing open and verify that the file is not presented as ready.
  • Fail another form field and check the documented retention of completed uploads.
  • Verify that another account cannot retrieve or attach the private file.
  • Replace an attachment and check both the new content and the old file's access state.
  • Verify removal and temporary-file cleanup within the agreed time window.

Full file upload testing checklist

1. Map the file states and the save boundary

Write down what selection, transfer completion, processing completion, and record save mean in the product. They may be separate operations with different failure outcomes.

For a processing model with retry attempts, deleted states, and stale worker results, see State Transition Testing: Examples and Test Cases.

  • A selected local file is not shown as a saved attachment before the required operations finish.
  • Transfer completion leads to the documented next state, including processing when applicable.
  • A processing failure leaves the file unavailable for attachment under the example rules.
  • Saving a record associates the intended ready file IDs with that record.
  • Reloading the saved record restores attachments from persisted data.

Identify which evidence comes from the UI, the upload response, the processing result, and the saved record. This prevents a passing UI observation from standing in for a missing service assertion.

2. Check selection, removal, and supported entry points

Exercise every upload entry point that the product offers, such as a file picker, drag and drop, clipboard paste, or a replacement action.

  • Selecting an allowed file adds the correct filename and size to the queue.
  • Cancelling the file picker preserves the existing selection.
  • Removing a queued file prevents it from being submitted later.
  • Selecting the same local file again follows the documented duplicate-selection behavior.
  • Alternative entry points enforce the same acceptance rules.

Verify the empty state and the selected-file list as well as the picker. A drop area should not silently ignore a rejected file while the picker explains the same rejection.

3. Separate picker hints from server validation

The HTML accept attribute helps guide file selection; it does not validate the selected file's type. MDN's accept documentation explains why the expected restriction also needs server validation.

  • The picker advertises the formats that the product actually supports.
  • Disallowed uploads are rejected when sent without using the picker.
  • A changed request filename does not bypass the service's format rules.
  • An unsupported format produces an actionable error without a usable attachment ID.
  • Client and server messages describe compatible restrictions.

Test client convenience and service enforcement as separate observations. A disabled selection in one operating system's picker does not establish that the upload endpoint rejects it.

4. Verify extension, declared type, and content handling

Compare the filename extension, the type declared in the request, and the file's actual format. Treat inconsistent inputs as deliberate fixtures with a defined expected result.

  • An allowed extension with unsupported content fails the documented validation.
  • A client-supplied content type does not override the content-validation result.
  • Uppercase extensions follow the agreed normalization policy.
  • Damaged files fail processing clearly instead of becoming broken ready attachments.
  • A failed validation leaves no downloadable file under the example policy.

The OWASP File Upload Cheat Sheet recommends combining controls for allowed types, content, filenames, size, storage, and permissions. It cautions against trusting the supplied content type or treating a file signature alone as sufficient protection.

5. Test individual file size in explicit units

Record the limit in bytes and state whether the endpoint is inclusive. A label such as "5 MB" is insufficient when the UI, service, and storage use different interpretations.

  • A valid file immediately below the maximum passes size validation.
  • A valid file exactly at the inclusive maximum passes size validation.
  • A valid file one byte above the maximum is rejected.
  • A zero-byte file follows the explicit empty-file policy.
  • A larger upload is rejected by the intended layer with a useful user-facing outcome.

Distinguish the uploaded file's bytes from the full request size, which can include other fields and transport overhead. For deriving neighboring inputs systematically, see Boundary Value Analysis: Examples and Test Cases.

6. Check count, combined size, and existing attachments

A file may pass its own validation while the final attachment collection exceeds a different limit. Include existing saved attachments in the calculation where the contract requires it.

  • Exactly three attachments can be saved under the example count rule.
  • Adding a fourth attachment is rejected without altering the saved collection.
  • A combined size exactly at 10 MiB is accepted when every file is otherwise valid.
  • A combined size one byte above 10 MiB prevents saving the changed collection.
  • Replacing a file evaluates the resulting collection rather than counting both versions as permanent attachments.

If two tabs can modify one record, submit changes that individually fit but exceed the limit together. Verify the final saved collection against the contract rather than trusting each tab's earlier counter.

7. Check filenames and file identity

Use harmless filenames containing spaces, punctuation, non-ASCII characters, and the product's supported length boundaries. Keep those tests separate from file-content validation.

  • The displayed filename remains readable without breaking the attachment list.
  • Distinct uploads with the same filename retain separate identities when permitted.
  • An existing file is not overwritten solely because its name matches a new upload.
  • Renaming a displayed attachment does not change which stored content it retrieves.
  • Rejected filename input cannot select an unintended storage destination.

Follow each upload by its file ID as well as its name. Two items called report.pdf may contain different reports; a filename-only assertion can miss an incorrect association or replacement.

8. Verify progress, cancellation, and late completion

A transfer indicator describes activity, but the file may still require processing and attachment. Make every important transition observable to the user.

  • Progress or a busy indicator identifies the file currently being transferred.
  • Completed transfer does not hide a pending processing state.
  • Cancelling one file leaves other queued or completed files in their documented states.
  • A completion arriving after cancellation does not reattach the cancelled file.
  • Cancelled temporary data is removed within the agreed cleanup window.

Test cancellation near completion as well as near the start. The late-result case matters because stopping a UI action and receiving a service response can happen in either order.

9. Exercise interruption, timeouts, and retries

Test a connection lost during transfer and a response lost after the service has accepted the file. These situations can look identical to the user while requiring different recovery.

  • An incomplete transfer is not offered as a ready file.
  • A retry uses the documented restart or resume behavior.
  • A repeated logical upload follows the agreed retry-token policy.
  • A completed upload with a lost response can be reconciled without duplicate attachments.
  • Other completed files remain available when one transfer fails.

Do not assume identical bytes mean the user intended only one upload. Distinguish a retry of one operation from two intentional uploads. If resumable transfer exists, verify the final content as well as its reported size.

10. Check processing and rejection after transfer

Hold a processing job open in the test environment, then exercise success and failure separately. This can represent scanning, image conversion, document validation, or another required step.

  • A pending file remains visibly pending until the required checks finish.
  • A successful result makes the correct file ready exactly as the contract defines.
  • A rejected result prevents attachment and retrieval under the example rules.
  • A processing-service failure exposes a recoverable or terminal state according to policy.
  • An older callback cannot make a cancelled or deleted file ready again.

Verify what happens when processing never returns. A timeout must have a defined state and recovery path; repeatedly polling an unexplained pending item is not sufficient evidence of a complete workflow.

11. Verify attachment saving and form recovery

An upload can succeed while the record save fails. Test the relationship between the staged file and the record instead of treating both as one atomic UI action.

  • A valid save links the intended file IDs to the correct record.
  • A failure in another field preserves ready files when that is the stated recovery rule.
  • Correcting the field and resubmitting does not create duplicate associations.
  • A failed save leaves existing saved attachments unchanged.
  • Switching to another record does not reuse the previous record's staged files accidentally.

Check the saved record after reload and through an independent read. A thumbnail still present in local page state does not establish that the association was committed.

12. Test ownership and authorization at each operation

Include upload, attachment, preview, download, replacement, and deletion in the permission review. Check the service directly as well as visible controls.

  • Account B cannot attach account A's private staged file to B's ticket.
  • Account B cannot retrieve A's attachment by substituting its file ID.
  • A user lacking edit permission cannot replace or delete the attachment.
  • An expired session produces the documented recovery without claiming a successful save.
  • A private-file response does not expose the content to an unauthorized caller.

Use the REST API Security Testing Checklist for the broader authorization review. Recheck generated previews and derived files too; a protected original does not establish that every rendition has the same access policy.

13. Verify preview and download content

Open the saved file and compare it with the fixture's identifying content. If processing intentionally transforms it, define which properties should remain rather than requiring an identical byte sequence.

  • Download retrieves the file associated with the selected attachment ID.
  • Preview failure does not silently substitute an unrelated image or document.
  • Supported transformations preserve the required readable content and orientation.
  • The returned filename and content metadata match the serving contract.
  • Refreshing or revisiting the record retrieves the current saved version.

For unchanged files, a digest comparison can help detect corruption. For regenerated previews or converted documents, compare the agreed output properties instead of assuming a different digest means failure.

14. Check replacement and version behavior

Specify whether replacing creates a new version, removes the old file, or leaves history accessible. The worked cases use atomic replacement with immediate application-access revocation for the old file.

  • The new file completes required validation before replacement commits.
  • A failed replacement leaves the original content and association available.
  • A successful replacement shows the new file after reload.
  • Late results from the old upload cannot overwrite the new association.
  • Old-version access follows the documented history and deletion policy.

Check both file IDs when their names are identical. A UI can show the replacement's label while a cached preview or incorrect association still opens the previous content.

15. Check deletion, abandoned uploads, and cleanup

Distinguish removal from the form, detachment from a saved record, and physical deletion. Record which action revokes access and when temporary objects are actually removed.

  • Removing a staged selection prevents it from being attached on the next save.
  • A saved deletion removes the expected association without affecting other attachments.
  • Deleted files are inaccessible through the application's read paths under the example policy.
  • Abandoned and partial uploads disappear within the configured cleanup window.
  • A late worker result does not recreate a deleted attachment or preview.

Where temporary download links or caches are used, test their documented expiry and invalidation behavior separately. A successful delete response alone does not prove every previously issued delivery path has stopped working.

16. Check multiple files and partial failure

Choose one valid file, one invalid file, and another valid file in the same interaction. Record whether the product supports independent outcomes or rejects the batch as a unit.

  • Each selected file receives an unambiguous individual status.
  • A failed file does not remove successful uploads under the example's independent-transfer rule.
  • Retrying one failed item does not resubmit the whole queue unexpectedly.
  • Removing one item updates the remaining count and size correctly.
  • The final save includes exactly the valid ready files selected for attachment.

Test a mixed queue in a different order as well. A defect that handles only the first item correctly can disappear when the fixture order never changes.

17. Check mobile, keyboard access, and validation messages

Use the supported browser and device matrix for the product. Test each advertised source, such as local storage, a document provider, or a camera flow, when available.

  • Keyboard users can reach selection, remove, cancel, and retry controls.
  • File status and validation information remain understandable without relying only on color.
  • Long filenames and error messages do not hide actions on a narrow screen.
  • Cancelling a mobile picker returns to the form without losing other data.
  • A permitted mobile image format is accepted, or an unsupported format receives a clear explanation.

Do not assume a camera-produced file has the same format or metadata as a desktop fixture. Verify the actual uploaded file against the product's allowed-format policy.

18. Record evidence and check the release workflow

Collect enough information to distinguish transfer, processing, association, and retrieval failures. Use ordinary synthetic files for a final approved-environment smoke check.

  • A test result records the fixture, byte size, file ID, target record, and expected outcome.
  • Processing failures can be connected to the corresponding upload through an approved diagnostic identifier.
  • User-facing errors do not reveal credentials, private storage locations, or another user's data.
  • A release smoke verifies upload, save, reload, download, and removal for the intended account.
  • Temporary fixtures are cleaned up without removing unrelated attachments.

For request and response evidence, adapt the structure in the API Test Cases Checklist. Use the product's documented response statuses and error fields instead of assigning one HTTP code to every upload rejection.

Ten worked file upload test cases

These cases use the support-ticket contract above. Reset the relevant account, ticket, staging state, and processing controls between cases. Any variants inside one case run independently.

Test case 1: Save and retrieve a valid attachment

  • Preconditions: Account A owns a valid ticket with no attachments; processing is available.
  • Input: A valid 262,144-byte PNG named screen.png, containing reference UPLOAD-01.
  • Steps: Upload the PNG, wait for ready status, save it on A's ticket, reload the ticket, and download the attachment.
  • Expected result: Exactly one attachment is saved with A's file ID; the downloaded image contains UPLOAD-01 and belongs to the intended ticket.

Test case 2: Check the inclusive individual size limit

  • Preconditions: A's ticket is empty and otherwise valid; use parseable PDFs with known sizes.
  • Input: Independent fixtures of 5,242,880 and 5,242,881 bytes.
  • Steps: Upload each fixture in a fresh setup. For an accepted file, complete processing and save the attachment.
  • Expected result: The 5,242,880-byte PDF can become ready and be attached. The 5,242,881-byte PDF is rejected for size and produces no usable attachment.

Test case 3: Reject a misleading extension

  • Preconditions: The service validates actual file format; A can upload to the empty ticket.
  • Input: A harmless text file renamed screen.png, with the request declaring image/png.
  • Steps: Submit the fixture directly to the upload service, then inspect its final validation result and attachment availability.
  • Expected result: The file is rejected for unsupported or invalid content; the declared type and filename do not make it ready or downloadable.

Test case 4: Enforce combined size when saving attachments

  • Preconditions: A's ticket has no saved attachments; all fixtures are valid PDFs that passed processing.
  • Input: Three files of 5,242,880, 4,194,304, and 1,048,576 bytes; in a fresh variant, replace the third with a 1,048,577-byte PDF.
  • Steps: Save each three-file collection independently and read the saved ticket afterwards.
  • Expected result: The exact 10,485,760-byte collection is saved. The 10,485,761-byte collection is rejected for combined size; that fresh ticket still has no saved attachments, and its ready staged files remain available for correction.

Test case 5: Recover when an accepted upload response is lost

  • Preconditions: The same-upload retry policy is enabled; the retry happens inside the 24-hour window.
  • Input: A valid PDF and retry token upload-01, reused with identical contents.
  • Steps: Let the service accept the upload but suppress its response in the test environment. Retry with the same token and contents, complete processing, and attach the returned file once.
  • Expected result: Retry resolves to the original staged file ID; the ticket has one attachment, and inspection of the upload records shows one logical upload for that token.

Test case 6: Cancel without a late attachment appearing

  • Preconditions: A's ticket has no attachments; the test environment can delay transfer completion.
  • Input: A valid PDF whose transfer is in progress.
  • Steps: Cancel the upload, release any delayed completion result, then save the otherwise valid ticket and advance the cleanup check to the contractual deadline.
  • Expected result: No attachment is added, the cancelled file is not downloadable, and its temporary data is removed within 24 hours after cancellation.

Test case 7: Keep processing files unavailable

  • Preconditions: A valid PNG has finished transfer; processing is deliberately held open.
  • Input: The staged file ID while its status is processing.
  • Steps: Attempt to attach and retrieve it, then release a successful processing result and repeat the permitted actions.
  • Expected result: While processing, attachment and download are denied without a saved association. After the file becomes ready, A can attach and retrieve the intended PNG.

Test case 8: Deny another account's file access

  • Preconditions: A owns a ticket with a ready private attachment; B has a separate account and ticket with no shared access.
  • Input: A's attachment ID submitted by B through the file-read and attachment-save operations.
  • Steps: As B, request the file and try to attach its ID to B's ticket; inspect both saved tickets afterwards.
  • Expected result: B receives no file content and cannot save that association. A's attachment remains unchanged, and B's ticket has no attachment referencing A's file.

Test case 9: Preserve a ready file after form validation fails

  • Preconditions: A is creating a ticket; its title is required, and staged-file retention is still active.
  • Input: A ready valid PDF and an empty ticket title.
  • Steps: Submit the form, observe the validation failure, enter a valid title, resubmit, and reload the created ticket.
  • Expected result: The first attempt creates no ticket and retains the ready file. The corrected attempt creates one ticket with the same file ID attached once, without another upload.

Test case 10: Replace an attachment and revoke the old file

  • Preconditions: A's ticket contains an old ready file; the replacement has passed processing. The example's atomic replacement and deletion policy applies.
  • Input: A new file with different visible content but the same display name as the original.
  • Steps: Save the replacement, reload and download it, attempt to read the old file through the application, then inspect cleanup at the deadline.
  • Expected result: The ticket references only the new file ID and content. The old file is marked deleted and cannot be read through the application; its stored data is removed within 24 hours after replacement.

Common mistakes

  • Stopping at 100% transfer. Processing or record save can still fail after every byte has arrived.
  • Testing only the file picker. A picker restriction does not demonstrate service-side enforcement.
  • Using invalid documents for size tests. A damaged fixture can produce the expected rejection for the wrong reason.
  • Checking only individual limits. Three valid files can still exceed the allowed combined size.
  • Treating filenames as unique identities. Matching labels can conceal an overwrite, incorrect association, or stale preview.
  • Retrying without checking saved state. A timeout can follow a successful upload, so resending may create an unintended extra file under an unsuitable retry policy.
  • Ignoring abandoned objects. A rejected save can leave private staging data that needs its own retention and cleanup checks.
  • Equating detachment with deletion. Removing a record link does not establish the physical object's state or the behavior of previously issued download paths.

FAQ

Form testing covers the broader submission workflow. File upload testing follows the file through validation, transfer, processing, attachment, retrieval, and removal. A form can submit successfully while referring to the wrong file or to a file that never became ready.

Use representative allowed files, an unsupported format, mismatched extension and content, a zero-byte file, a damaged supported file, and valid fixtures around each size limit. Add filename and device-generated examples relevant to the product. Record exact bytes and keep unrelated properties valid when isolating one rule.

Not necessarily. Some products first create a staged upload and attach it during a later form save. Confirm the association through a saved-record read or reload, then retrieve its content. Follow the product's actual workflow when transfer and save happen together.

The expected result depends on the retry contract. The examples require the same token and contents to resolve to one logical upload. Two deliberate uploads may legitimately create two files. Record the supported retry window and how the client reconciles an uncertain result before assigning pass or fail.

Use approved test fixtures or controlled processing responses in an isolated environment. Verify pending, accepted, rejected, failed, and timed-out outcomes and their effects on attachment and retrieval. Exercise the configured scanning integration separately; a simulated status transition does not prove detection quality.

No. The list shows record associations, not every temporary or stored object. Check application access and use an approved storage inventory or cleanup-job result for the agreed retention deadline. Include generated previews and incomplete transfers when they are part of the workflow.

Ready to turn this guide into a working QA project with statuses, comments, and CSV export?