What is the best way to upload a temporary & sensitive file and then delete it when done

I was facing the same issue and finally wrote some code, you will find the source code here. https://github.com/HeyMehedi/Temporary-File-Manager