Let file_uploader return path, instead of reading the file in
Thanks for implementing the file_uploader widget, I was really looking forward for that.
Problem
My issue is that I expect large files (up to GBs), and thus reading them directly into memory is not acceptable for me.
Solution
separate file_picker One option would be to implement it as a separate widget (e.g. file_picker), which would just help to locate the file without uploading it.
optional upload Other possibility that comes to my mind would be an option (e.g. upload=False), that would allow me to choose not to upload the file. String with absolute path would be returned instead.
Also as mentioned in other issues, even if I could work with the file itself, I'd still need it's path, name, suffix etc. to work with.
URL Maybe in the future, but it would be really nice if the widget could also accept an URL.
Thanks in advance for considering the changes.
Community voting on feature requests enables the Streamlit team to understand which features are most important to our users.
If you'd like the Streamlit team to prioritize this feature request, please use the ๐ (thumbs up emoji) reaction in response to the initial post.
Hi @eliska-malanikova and happy 2020! ๐
Are you trying to read a file on the computer running the Streamlit server (where you ran streamlit run) or on the Streamlit client (where the browser is)?
If the former, you can create an ad-hoc file selector like this. Does this help?
Hi @treuille, thanks for the quick reply and happy new year to you too.
Currently it's both, server and client, but the aim is to let the user pick files from their own computer (the client), so it would be helpful to let them browse through the folders. So unfortunately, what you proposed does not help me. However, I first let them do some set-up (like define several files), and just after they're finished I read and process the files.
Got it. Thanks @eliska-chalupova . We will take your feedback into account as we plan updates to the file_uploader API. Thanks!
Great, thanks @treuille for the consideration. Good luck with the updates.
A functionality which returns the path would be useful for me as well. My use-case is that I want the user to be able to select a folder in which different files are stored, without them having to manually copy-paste the path.
I would like to add my support for this request as well. For my use case, the server will be in the same file system. The size of the file is typically big and hence not reasonable to upload. I currently use tk as a workaround. But it would be very nice if the file uploader can support file selctor and also return the path.
Hi - I too would like to add my support for this request. In particular it'd be nice to get the name of the file added to the file_uploader. I'd also like a way (or would like to know how) to reset the state of the file_uploader so it doesn't take the value of the previously uploaded file when the page is re-evaluated.
I've been using streamlit a lot, and presented it to our Data Science community in Oxford to much excitement. Many thanks for this excellent platform! There are still some weird things to get your head around regarding how the code is diff-executed and it does affect the code structure a little, but apart from that a really awesome tool!
+1
My use case is I am writing a tool to retrieve data from files, and it requires a third-party reader to read the files first and that reader requires a file path instead of an IO object. For now, I have to put the file paths in a select box for interactions, but I will have to copy/paste the path into the source code and every time be sure to choose the right one from the drop down list. If the file_uploader could return a file path, it will be more awesome.
+1
As a file is selected, I would like to upload it to GCP, and I need the path to avoid storing it before the upload. As written by @cuteufo, If the file_uploader could return a file path, that would be awesome.
Thanks a lot for the amazing work!
Hi anyone can tell how to write code for reading only for file path?
New file uploader widget is great! But Iยดm still wondering if it is possible to reading in file path?
It would be really nice to have something like uploaded_file.fullpath. The reason is I want to create a COM Object and need to pass a string but uploaded_file.name is not working.
This appears to still be a pressing issue with no clean solution. The suggestion outlined in another post is close but selecting any directory outside of that of the app is difficult to set. My use case would be to run the app locally and to access files larger than 200 MB where having access to the file can minimize a full upload into memory.
Hi @treuille , are there any updates on this feature request?
Hi @rembishj : For server-side file selection, I would suggest something like this snippet.
Hi once again @treuille, is anybody working on this feature?
I would like to be able to save full path of a filename uploaded by user (with st.file_uploader), .name is not enough for me ๐ฅ
Hi @mtszkw and others: I'm a PM at Streamlit and wanted to share that this feature is on our roadmap. We're working on higher priority stuff right now, so currently it's not being actively developed. The earliest we will be able to get to it is probably end of Q3, 21. Thanks, and stay tuned!
Hi thank you I will wait for it is going to be really useful
Hi thank you I will wait for it is going to be really useful
+1
waiting for this feature to get the file path.
someone with a temporary solution for now?
Any update on this?
+1 for this feature.
+1
+1
any update/ETA on this ?
Any update on this?
cc: @jrieke
+1
+1
+1