[thelist] PHP Based file download system.

Tanner Burson tanner at younet.okstate.edu
Tue Jul 29 13:25:48 CDT 2003


*This message was transferred with a trial version of CommuniGate(tm) Pro*
Simon Willison wrote:

>*This message was transferred with a trial version of CommuniGate(tm) Pro*
>Hi Tanner,
>
>Tuesday, July 29, 2003, 6:47:39 PM, you wrote:
>  
>
>>I have been charged with designing and implementing a large web based
>>file download system.  It needs to restrict users from downloading a 
>>file more than once and track some basic usage stats.  This part is easy 
>>and I can easily handle.
>>    
>>
>
>  
>
>>My problem is dealing with incomplete downloads.  If a user is only 
>>allowed to download a file once, how do I track a completed download?  
>>Should I just go with a timestamp based system where a user has X amount 
>>of time to get the file?  Any help would be much appreciated.
>>    
>>
>
>Unless you are absolutely certain all of your users are on a reliable
>broadband connection, a timestamp solution is not a good idea. Since
>you are using PHP, a possible solution would be to have a piece of
>code at the very end of the script that hands the user the file which
>sets a flag in the database to say the download has been completed. I
>remember reading somewhere that PHP scripts are aborted if the user
>disconnects before the script has fully executed (I can't confirm this
>so it is something you would have to check) - if so, the "download
>complete" flag would only be set once the user had completed their
>download.
>
>Only allowing users to download a file once seems like quite a strange
>requirement to me. What if a user downloads the file, then
>accidentally deletes it and needs to download it again?
>
>Cheers,
>
>Simon
>  
>
The problem I'm seeing is that once I had the file off to the user, the 
script will have stopped execution.  The reason behind the one use 
restriction is that the system is for distribution of paid software.  We 
have enough licenses for each user to have a SINGLE copy but that is 
all, so we need to restrict them to one copy only.  I'm just at a loss 
as to how to determin the download completed successfully.  Thanks again,

Tanner



More information about the thelist mailing list