Streamlit File Uploader Error: request failed with status code 413

Hello Streamlit community,

I was testing out the “st.file_uploader()” option on my web application, and I seem to get the following error when I tried an image that was just 3925 KB large:

I was not sure why this occurred despite the fact that Streamlit said that it could support files no larger than 200 MB.

Thank you!

Hey @joegenius98 - huh! Yeah, that doesn’t sound right.

I’m not able to repro this locally with a dead simple script that just contains a call to st.file_uploader - can you post an example script that reproduces it?

(Is your app deployed somewhere, or sitting behind a proxy? Is it possible there’s some other middleman service that’s causing the failure?)

Hi @tim! Thanks for reaching out!

After a lot of investigation, you turn out to be right. The service in which my app is deployed on is responsible for my error, since the service limits to file upload limits no greater than one megabyte. Specifically, the Nginx line:

client_max_body_size 1M;

seems to be responsible for causing the error.

I apologize for thinking that this was a Streamlit error in the first place. I am a novice to web application deployment. I genuinely thought that the error was within Streamlit for a long while, until I decided to investigate around the “Nginx” tab that I noticed in my editor, because I felt that could somehow lead to the answer.

I am taking care of the issue with those who maintain the deployment service I use.

No need to apologize Joe! All of us are beginners at something :slight_smile: