I'm thinking about a way to store and serve some files. Basically the files will be user uploaded doc files (via web form) - they are not overly important but might contain some personal info about the user who uploads them.
Only certain users and the uploader should be able to view these files.
They are currently stored in /files/ and the filenames are md5 hashes of the filename and some random 8byte string which should make them very hard to guess. I have a blank index.php in there to stop any directory viewing.
I was thinking of adding another layer of security which would default all these files to be unreadable and then send users who want to download them through a script which checks the user downloading it is valid, does a chmod on the file to make it readable, and then chmod back to being private later.
What are people's thoughts on the security of this? Does anybody have abetter idea of how to do this? Would the directory in the be susceptible to file scraping?