Hi,
I am having issues with using the st.file_uploader. After what seems to be about 10min of trying to upload a 20GB file I am presented with a Connection Timeout msg. The process bar of the file uploader will be “full”, but then it just sits there till it times out. I have had successes with files of up to 10GB, but running into issues with this 20GB file.
Is there some way to adjust this timeout?
Am I trying to upload to big of a file?
Streamlit version 1.27.2
OS: Ubuntu 22.04
Running on an EC2 instance.
It’s a common error when the size of the file is greater than 10GB, the issue arises.
You can check about the issue here.
opened 11:20AM - 11 Jan 23 UTC
type:bug
feature:st.file_uploader
status:confirmed
priority:P2
### Checklist
- [X] I have searched the [existing issues](https://github.com/… streamlit/streamlit/issues) for similar issues.
- [X] I added a very descriptive title to this issue.
- [X] I have provided sufficient information below to help reproduce this issue.
### Summary
Uploading a large file with `st.file_uploader` can reliably lead to a:
```
ValueError: Value out of range <num-uploaded-bytes>
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 565, in _run_script
exec(code, module.__dict__)
File "/Users/skekre/Downloads/streamlit-misc/file-uploader-size.py", line 3, in <module>
f = st.file_uploader("Upload a file")
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/streamlit/runtime/metrics_util.py", line 311, in wrapped_func
result = non_optional_func(*args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/streamlit/elements/file_uploader.py", line 338, in file_uploader
return self._file_uploader(
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/streamlit/elements/file_uploader.py", line 418, in _file_uploader
file_uploader_state = serde.serialize(widget_state.value)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/streamlit/elements/file_uploader.py", line 108, in serialize
file_info.size = f.size
```
where "large" in my case was approximately close to or greater than 4.5GB. I'm not sure whether the specific size after which this error is thrown is machine dependant. @serdar-bayramov who first [reported](https://discuss.streamlit.io/t/how-to-upload-large-files-using-st-file-uploader/35654) this on the Streamlit forum encountered the error for files >= 2GB.
### Reproducible Code Example
```Python
import streamlit as st
f = st.file_uploader("Upload a file")
if f is not None:
st.write(f.name)
st.write(f.size)
```
### Steps To Reproduce
1. Create a `.streamlit/config.toml` file to set the upload limit to 4.5 GB:
```toml
[server]
maxUploadSize = 4500
```
2. Create a 4.4 GB file:
```sh
truncate -s 4280m example.file
```
3. Run the above app and upload `example.file` to the file uploader widget
### Expected Behavior
As the uploaded 4.4 GB file is under the 4.5 GB limit set in `.streamlit/config.toml`, one would expect:
1. to see the upload successfully complete
2. the file uploader widget to be visible after the upload
3. see the output of the filename and filesize displayed
### Current Behavior
1. Once the progress bar on the file uploader widget hits the maximum, the app greys out for a few seconds while the Running man icon is displayed in the top right corner
2. Immediately after that, the file uploader widget disappears, leaving the user with the following error:

### Is this a regression?
- [ ] Yes, this used to work in a previous version.
### Debug info
- Streamlit version: 1.16.0
- Python version: 3.9
- Operating System: macOS
- Browser: Chrome
- Virtual environment: NA
### Additional Information
First reported by @serdar-bayramov in https://discuss.streamlit.io/t/how-to-upload-large-files-using-st-file-uploader/35654
### Are you willing to submit a PR?
- [ ] Yes, I am willing to submit a PR!
Once try to increase the size limit to above 20000 and try.
Hope it will solve this issue.
I am not prompted by a “Value out of Range” though. Streamlit is just presenting me with a Connection Timeout after roughly 10min.
My config.toml is already setup with a very high max upload size.
[server]
maxUploadSize = 200000
system
Closed
April 22, 2024, 6:31pm
4
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.