nginx also needs to be configured
The setting above only controls Flask's internal limit. If your server runs nginx in front of Flask (typical in production), nginx has its own separate upload size limit — client_max_body_size — which defaults to just 1 MB. Any file larger than that is rejected by nginx before Flask even sees the request, which causes the "File is too large" error regardless of what is set here.
In your nginx site configuration block, set this to match or exceed the value above:
server {
...
client_max_body_size {{ (site.server_max_upload_mb|default('500'))|int + 100 }}m; # Flask limit + 100 MB headroom
...
}
After editing, reload nginx: sudo systemctl reload nginx