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.