Download completion detection

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mickey

    #1

    Download completion detection

    Hi all,

    Is there a way to find out when a user has completed a download?

    I ask this because I have a current system where users download files,
    however due to serious bandwidth issues I need to limit the amount of
    downloads at one time.

    Ideally, I want to be able to allow a maximum of 5 members to access
    the download page at one time (with one download per person at one
    time), and then let the next user download.
    I was thinking, have a db table, file... with a counter, increment the
    counter with every file downloaded started, and then decrement the
    counter on completion of the file, but how do I know when the user is
    finished the download?
    Am I over complicating this?

    Has anybody got any suggestions that may help?
    I would really aprechiate any help or suggestions at all.

    Thanks in advance.

  • Sjoerd

    #2
    Re: Download completion detection


    Mickey wrote:[color=blue]
    > Is there a way to find out when a user has completed a download?[/color]

    You can let a PHP script supply the download:

    <?php
    readfile('downl oad.exe');
    database_query( 'UPDATE downloadcount SET number=number-1');
    ?>

    Beware of the maximum execution time: if the download takes more than
    30 seconds, it will abort. See set_time_limit( ).

    Comment

    • Jasen Betts

      #3
      Re: Download completion detection

      On 2006-02-18, Mickey <mickey.allroid @gmail.com> wrote:[color=blue]
      > Hi all,
      >
      > Is there a way to find out when a user has completed a download?[/color]

      serve the file using PHP and record the start an end of the sending
      a database or file etc...

      --

      Bye.
      Jasen

      Comment

      • Jasen Betts

        #4
        Re: Download completion detection

        On 2006-02-18, Sjoerd <sjoerder@gmail .com> wrote:[color=blue]
        >
        > Mickey wrote:[color=green]
        >> Is there a way to find out when a user has completed a download?[/color]
        >
        > You can let a PHP script supply the download:
        >
        ><?php
        > readfile('downl oad.exe');
        > database_query( 'UPDATE downloadcount SET number=number-1');
        > ?>
        >
        > Beware of the maximum execution time: if the download takes more than
        > 30 seconds, it will abort. See set_time_limit( ).[/color]

        Yeah, that's what I meant, but also increase the downloadcount before the
        readfile.

        This also means that users will not be able to resume aborted downloads.
        but will have to restart them.


        --

        Bye.
        Jasen

        Comment

        • Richard Levasseur

          #5
          Re: Download completion detection

          There are also various modules and options for apache (or whatever
          webserver you use, more than likely) that allow you to limit the
          bandwidth, number of connections, etc.

          mod_bandwidth for apache, iirc, though there are probably more

          Comment

          • Mickey

            #6
            Re: Download completion detection

            Thanks for all the suggestions.
            In the end I used :
            [color=blue]
            ><?php
            > database_query( 'UPDATE downloadcount SET number=number+1 ');
            > readfile('downl oad.exe');
            > database_query( 'UPDATE downloadcount SET number=number-1');
            > ?>[/color]

            Thanks again.

            Comment

            Working...