A customer uploads a logo, refreshes the page, and finds it missing. Or the image works today but its link expires tomorrow. Both failures come from treating “the upload finished” and “the file is stored safely” as the same thing.
A safe upload uses two places. File storage keeps the actual file. The database remembers its permanent ID, why it exists, and who owns it.
What should the app save?
Save the permanent file ID, not a temporary download address. On JustDeploy, a signed download address is a temporary link that also acts as permission to open the file. It expires after one hour. The app should use the file ID to request a fresh address when an approved customer wants the file.
The database record should also keep the display name, file type, size, owner, purpose, and upload time. Those details make it possible to search, protect, replace, and clean up files later.
How does a complete upload work?
- The app asks Storage to create a file record.
- Storage returns a file ID and a one-use upload address.
- The browser sends the file to that address.
- The app waits until Storage reports that the file is
active. - Only then does the app attach the file ID to the customer's record.
These are steps inside the software, not a row of buttons you should find in the console. Ask your coding AI to connect them. Then test the visible result: the same file should open after a refresh, a later visit, and an app update.
The browser should never receive your project's main private access key. The one-use upload address already contains the limited permission needed for that file.
What should be checked before the upload starts?
Set a size limit and allow only the formats the feature needs. Reject empty files and clean up the display name. A file's name and stated type can be wrong. If the upload contains sensitive information, the app may also need to check the file itself.
- Confirm that the signed-in customer may upload to this record.
- Limit how many unfinished uploads one account can create.
- Do not display an uploaded file as a web page that can run code.
- Use safe download settings for private documents.
When is a file ready to use?
A finished transfer does not always mean the file is ready. Check its status. Use the file when it becomes active. Show the reason if it becomes failed. Offer a safe retry if the check takes too long.
Do not publish a link to a file that the upload process has not finished creating.
What happens to interrupted or replaced uploads?
An interrupted upload can leave behind an unfinished file that is not attached to any customer. Delete the file when validation or transfer fails, and regularly remove old unfinished files that escaped cleanup.
When replacing a file, upload and check the new one first. Then update the database and remove the old file. This order keeps the current file available if the replacement fails.
Who may download the file?
A public product image and a private identity document need different rules. Public assets can use a stable app address. Private files should receive a short-lived download address only after the app checks the current customer's ownership or sharing permission.
A hard-to-guess link is not protection. Every action that creates a private download link needs the same permission check as the rest of the customer's data.
How do you test a file from upload to deletion?
| Test | Expected result |
|---|---|
| File is too large or the wrong type | It is rejected early with a clear message |
| Transfer is interrupted | No customer record points to an incomplete file |
| A new version is published | The existing file still opens |
| Download address expires | The app creates a new one from the saved file ID |
| Another customer requests it | No download address is returned |
Test deletion too. A safe upload feature handles every step: create, send, check, save, open, replace, and remove.
What should you read next?
- Where Does Your AI App Save Customer Data?
- How to Add Login Without Exposing Customer Data
- AI App Launch Checklist for Solo Founders
Use the JustDeploy Storage guide when you are ready to connect the upload flow.