Security//4 min

Let Customers Send Files Without Exposing Their Information

A file button needs clear rules. Limit what people can send, reject files that are too large, store them safely, and check who may open them.

before you start

Before customers send real photos or documents, make sure your app knows what to accept, where to keep it, and who may open it.

Choose exactly what people may send

in plain words

Accept only the few kinds of files that match the purpose of the form.

A button for sending files lets customers place photos or documents into your app. That may be useful for profile pictures, receipts, identity documents, or support requests. It also means someone can try to send something the app was never designed to handle. Begin with a short written list of what the feature genuinely needs. A receipt field might accept JPG, PNG, and PDF files, while a profile-picture field might need only JPG and PNG images.

Do not trust only the letters at the end of a filename. Someone can rename an unrelated file from item.exe to receipt.pdf without changing what is inside it. Your app should inspect the file’s stated kind and its actual contents before saving it. The technical name is file type validation. For images, ask the app to confirm that the file can really be read as an image. For a PDF, ask it to confirm the expected PDF structure. Refuse mismatches and explain the accepted choices in ordinary language.

  • ▸Show the accepted file kinds beside each file button.
  • ▸Try one allowed file, one renamed file, and one unneeded file.

common risk

A receipt form accepts every kind of file, so it saves an attachment that the feature was never designed to read or display.

what to do now

Write the smallest useful list of accepted file kinds and apply it before any file is saved.

ask your AI

Update every file field in this app. For each field, list the allowed file kinds beside the button. Accept only JPG and PNG for profile photos, and only JPG, PNG, and PDF for receipts. Inspect the actual file contents as well as the filename, reject mismatches before saving, and show a clear message naming the allowed choices. Add tests for a valid file, a renamed invalid file, and a disallowed file.

Stop files that are too large

in plain words

A maximum size keeps one file from consuming too much space, time, or money.

A phone photo, scanned document, or video can be much larger than it appears on screen. Without a maximum, one accidental choice or many repeated attempts can consume storage space, make customers wait, and increase your bill. Choose the smallest size that works with real examples. A profile photo usually needs much less room than a multi-page document. Use a separate limit for each purpose instead of allowing one very large size everywhere.

Show the maximum beside the file button so people know the rule before choosing anything. Check the size again in the computer service that receives and saves the file; developers call this server-side size validation. This second check matters because a visitor can sometimes bypass a rule shown only on the page. Reject an oversized file before permanent saving, remove any unfinished copy, and give a helpful message such as “This file is over 10 MB. Choose a smaller PDF.” Test files just below and just above every limit.

  • ▸Choose a separate maximum for photos, receipts, and other documents.
  • ▸Confirm that an oversized file is refused and leaves no saved copy.

common risk

A customer repeatedly chooses a large video in a receipt field, and the app spends time and storage space accepting each attempt.

what to do now

Set and display a maximum for every file field, then test both sides of each limit.

ask your AI

Add a documented maximum size to every file field in this app. Use 5 MB for profile images and 10 MB for receipt PDFs unless an existing product requirement is smaller. Show the limit beside the button. Enforce it both on the page and in the code that receives the file, refuse the file before permanent saving, remove unfinished copies, and test files just below and just above each maximum.

Keep saved files away from public pages

in plain words

Customer files need a protected location and new names that other people cannot predict.

Your app has an area containing pages, logos, and other items that any visitor may receive. Customer uploads do not belong there. Save them in a separate place that is not open for public browsing. The technical name for that place is private storage. A person should receive a file only after the app has checked that the person is allowed to see it. Turning off a visible file list is not enough if someone can still guess an address and open the document directly.

Create a new, unpredictable saved name for every file instead of trusting the customer’s original name. Two people may both send receipt.pdf, and one file must never replace the other. An original name can also reveal customer information in records or addresses. Keep it only when the person needs to see it, and display it as ordinary text rather than instructions the app could follow. Passwords, payment keys, and access codes must never be written into downloadable files or file addresses. Record which account owns each saved file.

  • ▸Confirm customer files are not stored with public pages or images.
  • ▸Send two files with the same original name and confirm both remain separate.

common risk

A document keeps its original name in a public folder, allowing another person to find it by trying a likely web address.

what to do now

Move customer files to protected storage, create new saved names, and record an owner for each file.

ask your AI

Move every customer upload out of public folders and into protected storage that cannot be browsed directly. Generate a long, unpredictable saved name for each file, keep the original name only as display text when needed, and record the owning account. Prevent one upload from replacing another with the same original name. Confirm that passwords, payment keys, and access codes never appear in downloadable files or file addresses.

Show each file only to the right person

in plain words

Being signed in is not enough; the app must confirm who owns the requested file.

Imagine Ana and Ben are both signed in to your app. Ana should not be able to see, download, replace, or delete Ben’s receipt merely by changing a number in a web address. For every file action, the app must compare the current account with the owner recorded for that file. If staff members need access, give it only to clearly named work roles that require it. The technical name for deciding what a signed-in person may do is authorization.

Make this decision in the computer service that handles the request, not only by hiding buttons on the page. A hidden button can reduce confusion, but it does not prove that a person may open the file. For sensitive documents, avoid permanent addresses that keep working when copied. The technical name for a short-lived address is a signed URL. Create one only after the ownership check, make it expire quickly, and do not place customer information in it. Test every action with two ordinary accounts, not only an owner or staff account.

  • ▸Try to view, download, replace, and delete another account’s file.
  • ▸Test ordinary customers separately from approved staff members.

common risk

The app requires sign-in but lets any signed-in customer open another person’s document by changing the file number in an address.

what to do now

Use two customer accounts to test every file action and block all movement across account boundaries.

ask your AI

Review every action that views, downloads, replaces, or deletes an uploaded file. In the code handling each request, compare the current account with the file owner, or with a specifically approved staff role, before continuing. Do not rely on hidden buttons or guess-resistant addresses. For sensitive files, create short-lived download addresses only after the check. Add automated tests proving that customer A cannot act on customer B’s files.

Repeat these checks whenever the app changes

in plain words

A working rule can be lost when you add a form, redesign a page, or change how accounts work.

Keep a short repeatable test: send an allowed file, a disallowed file, a renamed file, an oversized file, and two files with the same name. Then use a second customer account to try viewing, downloading, replacing, and deleting the first account’s file. Copy a file address into a new private browsing window, which is a fresh visit without the original account’s sign-in, and confirm that it does not reveal the document. Record the result and remove test files when finished.

Repeat the test after changing a form, file storage, account roles, or download behavior. Ask your AI builder to explain in everyday language where every check happens, so you can notice if a new screen skips one. VibeCodeWall checks the public app from the outside and watches for important changes over time; it does not need access to private code. That outside check complements your account tests, but it cannot replace checks involving customer files that the public app cannot see.

  • ▸Keep the repeatable test with your app’s change checklist.
  • ▸Review results after changes and remove old test files.

common risk

A new support form saves attachments without the rules already used by the original receipt form.

what to do now

Run the full file test after every relevant change and keep watching the public app over time.

ask your AI

Create a repeatable file-safety test plan for this app. Cover allowed, disallowed, renamed, oversized, and duplicate-name files; protected storage; expired download addresses; and view, download, replace, and delete attempts using two ordinary customer accounts plus each approved staff role. Explain in everyday language where every rule is enforced. Run the available automated tests and give me a manual checklist for anything I must verify myself after future changes.

Quick checklist

  1. 01Accept only the file kinds customers genuinely need.
  2. 02Check what each file contains, not only what its name says.
  3. 03Set a suitable maximum size for every file field.
  4. 04Give every saved file a new, unpredictable name.
  5. 05Keep customer files away from pages and images anyone can open.
  6. 06Check the person’s account before showing, replacing, or deleting a file.
  7. 07Test with two customer accounts and a file that is too large.
  8. 08Repeat the checks after every important app change.

FAQ

Is checking the filename enough?

No. A person can rename a file without changing its contents. Check both what the name claims and what the file actually contains before saving it.

Must customer downloads be open to everyone?

No. Keep the files in a protected location and check the current account before providing each download.

How do I choose a maximum size?

Use the smallest size that handles real examples from your customers. Test an ordinary phone photo or document, then test files just below and above the chosen maximum.

Why should I test with two accounts?

Two ordinary accounts let you confirm that one customer cannot view, replace, or delete another customer’s files.