I have some code which monitors a directory waiting for a new file to be written there by a PDF printer. Which works fine.
The problem is when I try to read it the file isn't fully written and is locked by the PDF printer process still resulting in fopen not being able to open the file for reading.
is_readable and is_writeable both return true.
I need a way of working out when the PDF printer has stopped writing and "unlocked" the file so I can read it. Does anyone know how to tell in windows if a file is locked - preferably from PHP 🙂