Hi I\'m creating online shop. In this shope people online must be buy files with zip extension. They pay with their credit cards or other methods get key and download produc
Unfortunatelly there is no really good way to do this as some clients might not download the file at once (e.g. Downloadmanagers split the download into several parralel part downloads).
Options are:
You should NOT just count the bytes downloaded (because the download might be disrupted). And NOT just determine if all sections have been downloaded once (also because the download might be disrupted)
Just to clarify: All this means that you have to write your own download handler (fileserver).
you can use custom file server that works on either http or ftp and have it send a notification once the client received the last file fragment.
all other options are problematic; the client might download the file using a download manager,so you cannot even register for any browser event, if there was any.
A custom server application seems indeed a solution for this, or possibly some kind of scripting.
A normal http server does not notify the end of a connection, but possibly, if you generate the output in a cgi/php/asp/* script, you read the file in cgi/php/asp/* scripting language and send it to the output. when you reach the end of the file, you do the notification, and then end the script.
When you do it that way, it will only detect fully downloaded files, and if the connection gets interrupted half-way, it would not mark the file as downloaded.
a 'cgi-script' can be a compiled c program, (or any other langauge for that matter). Compiled code anyways. A compiled program would give better performance then a interpreted script solution.