I’m trying to upload a zip file as bytes to my server. But the server is giving a 404 error. For all the other requests the server is running fine, so don’t know what is going wrong.
I’m passing zip_file = uploaded_file.getvalue() as the parameter for the function that creates and sends the request:
How can I make sure if the file is properly included in the request? The idea is to send the bytes (preferentially as base64), then reconstruct the zip file once receiving it at the server side.
Do you know how to compress/uncompress it? I thought the zip was already doing it. One thing that I thought is that the json string might be too large, so it increases the payload. But I don’t know another way to serialize it aiming to decrease the payload.
Another possible issue is that I’m using Ngrok on the server side, so it may have this limitation on the data amount it can receive, but I’m not sure about that.
Zip does compress the file, but with many tools you can control the amount of compression that it does. That might not make much of a difference, but you might give it a try. For example, zip -9 file.zip original_file, the -9 is the maximum compression (which is slower).
Most likely the issue is from the server itself, and has nothing to do with streamlit. I would recommend looking at documention for the server you are using (ngrok or whatever is the underlying server) to figure out if it limits the amount of data you can send, and if it’s possible to increase that amount.
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.