A supplier portal accepts specification documents from outside companies. Its file picker allows PDFs and images, and the interface rejects large files. The team assumes uploads are controlled. A direct request to the upload endpoint, however, never passes through that picker. Secure file upload design must enforce its rules where the file is accepted and served.
Treat an uploaded file as untrusted material with a lifecycle. Receiving bytes, checking them, associating them with a business record and making them retrievable are different actions. A clear lifecycle prevents the storage location from silently becoming a public approval decision.
Authorize the upload before accepting its purpose
For a fictional supplier portal, confirm that the signed-in supplier is allowed to add a specification to the selected product. The caller should not gain that ability merely by knowing a product identifier or a storage path.
Set appropriate limits for the operation and handle incomplete transfers deliberately. A temporary file should not become an accepted specification because the browser displayed a progress bar at completion. The application needs a clear record connecting the upload attempt, the supplied file and the intended product.
Use generated storage identifiers instead of trusting an incoming filename as a directory instruction. Keep a separate display name when useful, and handle unusual characters safely wherever that name is shown. A readable filename and an authoritative object key serve different purposes.
Apply complementary validation layers
OWASP's file-upload guidance recommends controls including allowlisted file types, size limits, safer naming and appropriate storage arrangements. It also explains why client-provided content types cannot be treated as trustworthy proof of a file's contents. Design the checks around the file formats the business actually needs.
Inspect the content using suitable libraries or services, and consider malware scanning or document-specific processing where appropriate. No single check establishes that every possible file is harmless. Choose a layered approach proportionate to the workflow and maintain the components doing the inspection.
Avoid accepting every format because conversion might be useful later. Each additional format adds interpretation and processing responsibilities. The supplier may only need a small, documented set of specification formats for the current product catalogue.
Keep pending material separate from available material
Use an explicit pending or quarantined state while checks run. The product page should not retrieve the object as an approved specification during that interval. A successful storage upload means the bytes arrived, not that every downstream check has passed.
Record the inspection outcome and give the supplier an understandable correction path. A rejected file should identify what can be changed without exposing sensitive scanner details or allowing arbitrary overrides. Failed inspection infrastructure may require a pending state, rather than treating unavailable checks as automatic approval.
These rules belong in the backend and storage design, where the application controls the transition into an available document. A visual review badge alone cannot enforce that transition.
Review retrieval as carefully as upload
Decide whether specifications are public, workspace-restricted or available through short-lived links. Use serving behavior appropriate to the content and its audience. An uploaded HTML document served as active same-origin content creates a different risk from a downloadable inert file.
Test unauthorized retrieval, a disguised file, an oversized request and an inspection timeout in a safe environment. Also test replacement: the old approved document may need to remain available while a new version is pending. A dependable upload feature gives both the supplier and the reviewer a clear answer about which document is available and why.



