# Uploads that work for you and fail for your users

> A photo upload works when you try it and fails for a normal user with a 403 from storage rules. Test it as a normal account, with a real file, and check after a reload.

By Jason Nguyen, Founder, Testsy. Published 2026-11-21. https://testsy.dev/blog/uploads-work-for-you-fail-for-your-users/

## "new row violates row-level security policy"

You add a profile photo or a document upload, try it, and it works. A user tries it and gets an error, or a spinner that never ends, or nothing at all.

On Supabase the message is so common it has its own page in Supabase's troubleshooting guide: [403 Forbidden, "new row violates row-level security policy"](https://supabase.com/docs/guides/troubleshooting/storage-error-403-forbidden-new-row-violates-row-level-security-policy-on-upload-a94384). An upload is a write to a table with its own access rules, and when no rule lets this user write this file, it is refused. The same page explains that switching an upload to "upsert" (replace if it exists) needs more rules than a plain upload, which is how one builder [fixed theirs](https://community.weweb.io/t/get-row-level-sec-error-when-uploading-images-to-supabase-from-weweb/14062) after following the docs and still getting the error.

Why it works for you:

- You try it with the service key, or in the dashboard, which skips the rules.
- You are an admin, and the rule only covers admins.
- You upload the same file name every time, and the rule for replacing a file is the missing one.
- The rule was written in your development project and never added to production.

## Test it as a normal user

The fix is not a better rule written by guesswork. It is a test that does what a user does, as a user.

1. Store a [sign-in account](https://testsy.dev/docs/sign-in-accounts/) that is an ordinary member, not you and not an admin.
2. [Attach a real file](https://testsy.dev/docs/test-files/) to the test, for example a small photo.
3. Check the result after a reload, not the success message.

```text
Sign in as the account "member".
Open Profile and upload the attached file avatar.jpg as the
profile photo.
Reload the page.
Check the profile photo is shown (not the default placeholder)
and no error message is on the page.
Upload avatar.jpg again to replace it and check the page still
shows a photo and no error.
```

The last step is the one people miss: the second upload of the same file takes the "replace" path, with its own rule.

## What an upload run looks like

Our practice site has an import and a document upload. One run imported a contacts file, rejected a broken one row by row and uploaded two documents by drag and drop.

![Three screens from the run: 25 contacts imported, the broken file's rows rejected by number, and two documents uploaded by drag and drop.](https://testsy.dev/blog/img/web-upload-import-screens.webp)

Open [the run](https://app.testsy.dev/share/OQ6pdvXBfxHGiDRrJ_PePZmeRtTgLLgd) (live until 18 February 2027). The full write-up, with a fake file and a file that is too big, is [Test file uploads: the good, the fake and the too big](https://testsy.dev/blog/test-file-uploads-good-fake-and-too-big/).

## What else to check while you are there

- **Another user's file.** Can a second account open the first account's upload by its address? That is the same rule, read side. See [Test that one user cannot see another user's data](https://testsy.dev/blog/test-that-one-user-cannot-see-another-users-data/).
- **The size limit.** A file over your limit gets a clear message, not a frozen page.
- **On a phone screen.** Run the same test at 412 × 914 ([sizes](https://testsy.dev/blog/test-a-site-at-phone-tablet-and-desktop-sizes/)): upload buttons are often hidden behind other elements on small screens.

If the run fails with the 403, the run's **Network** tab shows the refused request and its status, which is the detail to paste into your coding agent with the [fix prompt](https://testsy.dev/blog/copy-the-fix-prompt-into-your-coding-agent/).

This post is part of [Testing an app you built with AI](https://testsy.dev/blog/test-an-app-you-built-with-ai/).
