Allowing file to be downloaded once
I need to write a script that will allow a user to download a file ONCE.
Is there any way to confirm that the download is complete and then remove the file?
Or something else?
I can think of a couple ways to do it, but there are flaws in each way - not huge flaws, but I'd like to find the best solution possible.
There is no way to do it, with http at least. You can control every byte you send, but you know nothing about what the client received.
Moreover it seems not to make sense to implement such protection (for some paid contents I guess). You cannot (technically) forbid users to redistibute downloaded files...
It has nothing to do with the protection of distrobution.
well, here's an ugly way to do it.
I'm assuming all users are unregistered.
set the system up with a db:
email (downloaders email address)
Then ask users to input their email addresses for download.
if email address is already in db & flag is 1, do not let them download and if not, let them download and input their address in db, alongwith filename of file they are dloading and set flag to 1.
if you do not want to go with email addresses, use IPs, but it's less reliable.
I put the flag column in the table up there in case you need to let someone who has already downlaoded it once to download again. you just need to flip the flag value to zero.
hope this helps.
Thanks! That is about what I came up with - just a flag to check if it has been downloaded.
Only problem I can see is people who get cut off halfway through a download and such...but I don't think there is a way around it?
Nope, you cant tell if a user has finished downloading the file.