# Delete saved files from a folder when user closes browser

**URL:** <https://discuss.streamlit.io/t/delete-saved-files-from-a-folder-when-user-closes-browser/31950>\
**Category:** Community Cloud\
**Tags:** session-state, streamlit-cloud\
**Created:** [October 14, 2022, 6:32am UTC](https://discuss.streamlit.io/t/delete-saved-files-from-a-folder-when-user-closes-browser/31950 "2022-10-14T06:32:44Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![blackary](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/blackary/32/47725_2.png) [@blackary](https://discuss.streamlit.io/u/blackary)\
**Post date:** [October 14, 2022, 2:53pm UTC](https://discuss.streamlit.io/t/delete-saved-files-from-a-folder-when-user-closes-browser/31950/2 "2022-10-14T14:53:34Z")

</div>

Hi @teyang-lau,

That sounds like a good use-case for a tempfile: [tempfile — Generate temporary files and directories — Python 3.10.8 documentation](https://docs.python.org/3/library/tempfile.html)

Here’s an example of a similar use-case showing how to use tempfiles with audio files. [File uploading and reading using st.file\_uploader - #2 by blackary](https://discuss.streamlit.io/t/file-uploading-and-reading-using-st-file-uploader/31897/2)

---

_[View the full topic](https://discuss.streamlit.io/t/delete-saved-files-from-a-folder-when-user-closes-browser/31950)._
