The second and third option would not be viable as my forum script needs to remain portable and no client/server communication is necessary. What I'm trying to achieve is a database that locks files so as to prevent accidental overwriting.
This is what I understood in a stepwise fashion:
- generate a temporary unique filename in the location of interest
- move said file to another temporary location
- work on temporary file in temporary location
- move temporary file back to location of interest
- analyze original file and determine what to do with temporary file
I'm not so sure I'd know where to begin in order to generate a unique filename, it would seem to me that if they're just randomly generated without any inter-dependancy then they might collide. Something like rfc4122 uuids for instance.