Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 16 to 17 of 17
Thread: How to Delete a File?
10-22-2013, 11:07 PM #16
Don't let them tear you down Tango. Stand your ground!!
My business rules says, "Only one instance of a given image can exist on the website."
The way I currently determine uniqueness is by using hash_file - regardless of where the image gets stored.
You can swap out Images on the File System or in the Database, but there still needs to be a mechanism that says, "This Image File ever only occurs once."
If I swapped out Images, then I'd also need to re-run hash_file and make sure the Image doesn't already exist.
That is *independent* of whether this happens on the File System or in the Database.
Your idea has merits, but I am thinking that mlseim's suggestion may have less side-effects.
What does everyone else think?
10-22-2013, 11:27 PM #17
That's almost like asking, "I wonder how many books in the library have the same number of pages?"
Whereas if I place unlink() in my "upload.php" script which resides in the Web Root, then any hacker that accesses that file could conceivably get around my best coding attempts and go crazy deleting files, right??
If I take that functionality and stick it somewhere that only allows "me" or a "CRON job" to run it, then I would think I have greatly reduced the risks...
Sorta like, "Don't give greater access rights to any one user than are needed to do his/her job."
I wouldn't want to give Jane User the ability to upload files *outside of the Web Root*, right?!
The more I think about it, isn't it safer to "sandbox" uploaded images and keep them *inside* the Web Root?
Gee, that is a whole new scary topic for which I don't know the answer...