how to know when download is finished

后端 未结 3 1463
被撕碎了的回忆
被撕碎了的回忆 2021-01-15 14:21

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

3条回答
  •  温柔的废话
    2021-01-15 14:49

    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:

    • If it is very important to you that it can only be downloaded once: You could simply not support resuming. Then you can log if the file has entirely been downloaded (as soon as the last byte has been sent). This might work well if the download is small.
    • Otherwise you could offer some grace data (we usually allow to download clients to download 5 times the size of the real download) and log every download attempt.

    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).

提交回复
热议问题