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…
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.