View Single Post
  #3 (permalink)  
Old 08-12-03, 04:18 AM
kickinhard007's Avatar
kickinhard007 kickinhard007 is offline
Newbie Coder
 
Join Date: Aug 2003
Location: Manchester, UK
Posts: 65
Thanks: 0
Thanked 0 Times in 0 Posts
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.
Reply With Quote