I'm writing a web page that accepts a .csv which contains sensitive PII (personally identifiable information). The site it's going to be on is hosted on a shared server. I currently have the script writing the uploaded file to disk, then reading that file, getting the info I need, then deleting the file. The file should be protected by the OS file permissions while it exists, but I realized that once deleted, it could theoretically be read by someone else on the system. What is the best practice/your suggestion for making this more secure? Keeping the upload in memory ( and dealing with all the security needed for that )? "Shredding" ( overwriting with random patterns or all 0's ) the file after processing before deleting? Something else that I haven't thought of?
EDIT: The shared server in question is on a reputable, PCI-compliant hosting service. I'm not just throwing stuff that should be secure on my neighbor's cousin's "web server".