file_uploader: support for multiple files#1183
Conversation
* develop: Unpin python-dateutil package version (streamlit#1153) Pypi nightly builds (streamlit#1171) Adding custom filterOptions function to SelectBox (streamlit#1182) Expire media files when ReportSession expires (streamlit#1128) 1159/use_container_width (streamlit#1174)
|
Quick question, if |
|
Correct - this is to preserve the existing API. There's an issue to deprecate the current API, and always return a list - but this PR doesn't implement any of that. |
monchier
left a comment
There was a problem hiding this comment.
Mostly sanity checks kind of comments and minor notes.
More high level: I thought we said at some point to standardize on snake case for python file names... Should we bring it up again?
| BytesIO or StringIO or or list of BytesIO/StringIO or None | ||
| If no file has been uploaded, returns None. Otherwise, returns | ||
| the data for the uploaded file(s): | ||
| - If the file is in a well-known textual format (or if the encoding |
* develop: Speed up `make jstest` on CircleCI De-flake ScriptRunner_test.py (streamlit#1195)
For posterity: we chatted about this in the standup yesterday, and it sounds like we haven't established a naming rule for python files. |
|
Looks good @tconkling . |
* develop: Another attempt at test_multiple_scriptrunners timeouts (streamlit#1211)
* develop: file_uploader: support for multiple files (streamlit#1183) Another attempt at test_multiple_scriptrunners timeouts (streamlit#1211)
* develop: Better error messages for st.cache (streamlit#1146) Fix st.cache (streamlit#1208) file_uploader: support for multiple files (streamlit#1183) Another attempt at test_multiple_scriptrunners timeouts (streamlit#1211) Speed up `make jstest` on CircleCI De-flake ScriptRunner_test.py (streamlit#1195)
|
it would be great if we can upload folders |
This adds basic support for uploading multiple files to a single st.file_uploader
st.file_uploadernow has a new flag,accept_multiple_files. It defaults to false.accept_multiple_filesis true, the frontend widget will accept multiple files, and the Python API will return a list of BytesIO/StringIO objects if 1 or more files are uploaded to the widget. (That is, even if the user uploads a single file, the multi-file uploader will always return a list. The single-file variant will never return a list.)UploadedFileManagernow stores lists of files bysession_id/widget_idkey, instead of just single files.Closes #912 (there are additional API changes to make to file_uploader, but we're going to be addressing them in future PRs.)