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:
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?)
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.
Sorry, please, faced the same problem. I get error 413, but files up to 1MB are uploading. Tried changing max_body_size, doesn’t help. Deploying to !npm
@joegenious98 is right. Thank you. For me, I just added this one line in /etc/nginx/nginx.conf
http {
…
client_max_body_size 200M;
}
and then restarted with
systemctl restart nginx
I also restarted the Streamlit process to be sure. And the error was gone. You may also have to add it under Server { …} and location /uploads{…} depending on your configuration…