My problem is an outgrowth of the old "store images (videos in this case) in the database or in the filesystem" debate.
I decided to use the filesystem in this case due to the size of the files being stored. But I have run into a problem that can best be described as a referential integrity problem. Here's what happened:
I tested the script which uploads the file and stores the pointer in the database. It worked fine-- file was moved to a folder the script created and and the pointer went in the database. Great! I'm done testing this script. So I then manually deleted the db records (multiple uploads tested) and then was going to manually delete the files. But I can't delete them because I'm not user 'nobody' (or whoever php is running as) :rolleyes:
Obviously, I'll have to write a script to delete them. That was the next script to write anyway, since these files are only intended to be available for a fixed time anyway.
You could say that I've lost referential integrity here... I've got orphan files with no database pointer to them. It's a problem that I created, but I would like to be able to be able to check for referential integrity so that I don't accidently get a whole bunch of orphan files sitting around.
Any ideas how to check for integrity?