Where are Uploaded Files Stored?

When you deploy an app to Community Cloud, you have one Streamlit server running your app. When a user visits you app, a thread is created to handle their session. You have one file system in one environment running that one Streamlit server. Files on disk are accessible to that Streamlit server and thus to all sessions. Session State is something that is unique to each session, but it is something that is “in memory” and not on disk.

If you don’t want files to persist, but do want them on disk, there isn’t anything to logically isolate those files for a Community Cloud app (at leas for files written to the Community Cloud environment). Tempfile is the best thing I know about to write things temporarily to disk.

If you want to save files that users can reload, I recommend using an external storage solution for that, like @Alexandru_Toader mentioned.

1 Like