Re: How to count transfered kBytes in File-Download

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Jim...  ;-)

The code:

----[ '/usr/share/tdphp-vserver/includes/02_functions.inc' ]------------
function fncPushBinary($type='show', $file, $mime='') {
<snip>
        $BUFFER=1024;

        $HANDLER=fopen($file, r);

        $CUR_SIZE=0;
        while ( !feof($HANDLER) ) {
          $CUR_SIZE+=$BUFFER;
          echo fread($HANDLER, $BUFFER);
        }
        fclose($HANDLER);

        fncUserUpdate($user, 'downloads', $file, $CUR_SIZE, $FSIZE);
        exit();
<snip>
}

function fncUserUpdate($user, $type, $file, $cur_size, $file_size) {
  echo "What The Hell Is Going On Here?\n";
  $HANDLER=fopen('/tmp/fncUserUpdate.log', a);
  $DATE=date("r");
  fwrite($HANDLER, "$DATE       $user   $file   $cur_size       $file_size\n");
  fclose($HANDLER);
}
------------------------------------------------------------------------

is working without any errors, but in my log I get every time:

----[ '/tmp/fncUserUpdate.log' ]----------------------------------------
Sun, 04 Jan 2009 18:48:51 +0100 dummy   /var/www/customers/konzack/CONFIG_musica.tamay-dogan.net/music/Iran/Arian_Band_-_Bi_To_Ba_To.jpg
Sun, 04 Jan 2009 18:49:44 +0100 dummy   /var/www/customers/konzack/CONFIG_musica.tamay-dogan.net/music/Iran/Arian_Band_-_Bi_To_Ba_To.jpg
Sun, 04 Jan 2009 18:53:22 +0100 dummy   /var/www/customers/konzack/CONFIG_musica.tamay-dogan.net/music/Iran/Arian_Band_-_Bi_To_Ba_To.jpg
------------------------------------------------------------------------

which is a little bit weird, since I  have  downloaded  the  files  with
'wget' and interrupted the transfer.

Speek, the $CUR_SIZE is always the filesize rounded up (1kByte) but  NOT
the actual downloaded partial size, which is, what I want...

Any sugestions?

Thanks, Greetings and nice Day/Evening
    Michelle Konzack
    Systemadministrator
    24V Electronic Engineer
    Tamay Dogan Network
    Debian GNU/Linux Consultant


-- 
Linux-User #280138 with the Linux Counter, http://counter.li.org/
##################### Debian GNU/Linux Consultant #####################
<http://www.tamay-dogan.net/>               <http://www.can4linux.org/>
Michelle Konzack   Apt. 917                  ICQ #328449886
+49/177/9351947    50, rue de Soultz         MSN LinuxMichi
+33/6/61925193     67100 Strasbourg/France   IRC #Debian (irc.icq.com)

<<attachment: signature.pgp>>


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux