I am new to FLASK. I have a simple FLASK Web App that takes user uploaded images, saves them in an "Uploaded_Images" folder, performs image manipulation, saves the manipulated images in "Output_Folder" and then allows the user to download all the images in the "Output_Folder".
This would be a public web app with no sign in process. So each user is tagged with a random session ID and an Uploaded_Images/Output_Folder is created for each session ID to avoid mixing user images. Then the user is able to download the images from their unique Output folder.
To avoid the user uploaded images and output images from persisting on the server after they leave the web app: I would like for both the user uploaded images and output images to be deleted from the server after they are sent from directory to the user or if the user exits the web app.
I am able to delete the uploaded images when the output images are created. However, I am unable to delete the user output images folder as I cannot call another function after send_from_directory().
How are these files normally deleted from a server? I am thinking that perhaps I need scheduled cleanup of server files?
Is the unique session ID per user on a public server a terrible user management system?