Get path from file_uploader()

I need to be able to retrieve the path and filename based on the user’s selection from the file_uploader. Having this information would allow me to update a json config file for future session automatic file loading.

Thank you for any advise.



Hi @555gam, welcome to the Streamlit community!

When the file_uploader widget is used, no file is actually created. The return value is a BytesIO object, which stays in RAM. If you’d like to save that file somewhere, you can choose to do so.


1 Like

Thank you for the welcome, Randy.

I understand the current operation of the file_uploader widget and I am using it in my app now! What I would like to have, in addition to the StringIO (in my case), is the path & file name that was selected by the user. The current file_uploader() does not appear to support such a return option but I wanted to find out if there were some other way. Or, how do I go about making an enhancement request to the library (I am new to this so please bear with me). Thank you for your quick reply!


I am having the same issue.

1 Like

Having same issue with the file_uploader , can’t access the file name,… and need to send it to a flask api
two files and a string, have issue understanding how the uploader works really :roll_eyes:

There might be issues regarding security and/or privacy. Though that feature would be useful for local apps that work with files that are already on the local file system and which do not need to be transferred. Optionally, a different function that is not called “upload” would be nice. Right now, I am using a text field that specifies the path for files I want to work with.

The uploaded does not create a file i.e. stores the data on the hard drive. Instead, it creates an in memory object that can be used as if it is is a file. You can add a function that write the file to the disc though. And here it would be nice to be able to have access to the file name and not just to its content. If I understand the issue right.

Hi @555gam,

have you found a workaround for this, or did you just ditch the file_uploader?

Having the same issue over here :grimacing:
Especially frustrating since there is the functionality to retrieve the file name.


Hi @fschlz @555gam,

I also need to get path of the uploaded file.

Have any of you found a workaround here?


Hey @MichalBZ,

Check out this link.
It shows how to use the base64 package and HTML to solve the problem.