Skip to content
Discussion options

You must be logged in to vote

Hello @armant,

Since Starlette has introduced parameters to control form parsing options: max_files, max_fields, and max_part_size. It's now possible to intercept the request with a middleware and call request.form() with the desired options.
Parsed form data is computed only once (and cached), so you won’t encounter any issues later when accessing the form through FastAPI.
The advantage of this approach is that you can control the size of each form dynamically, based on the incoming request.

That said, there's no doubt we should have a way to control these parameters globally.

Replies: 3 comments 13 replies

Comment options

You must be logged in to vote
13 replies
@wordhui
Comment options

@reith
Comment options

@armant
Comment options

@luzzodev
Comment options

Answer selected by YuriiMotov
@Nixxs
Comment options

@luzzodev
Comment options

luzzodev Jul 5, 2025
Collaborator

@alex-700
Comment options

@luzzodev
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Question or problem answered