Aha! Got a better thought!
Why don't you store the file in the database itself (assuming the file isn't huge) and have a column in the database named 'locked'.
then, the upload script would set the value of 'locked' to, say, 1. this would mean that the file itself is locked. the download script could have a bit of code that checks for the value of 'locked' before it starts the downloaded...i.e download if value = 0, or abort if value = 1.
the upload script would basically change the value to 1....upload the file, then change the value back to 0 so it can be downloaded again.
only issue is determining whether or not someone is already downloading the file, but there are ways round that.
i might have time to write the code if you need help.