Re: How to count transfered kBytes in File-Download

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

 



Good morning Jim,

Thank your for your help, I will now adapt my scripts and test it.

And if a user had done a partial download, how can I set the pointer  to
resume the download?  I personaly find websites offering  downloads  but
not resuming very annoying, so I like to do it better...  :-)

I know I have to get a $_HTTP['????'] header for  the  partial  request,
but which?  And then I have too seek fread() right?  But how?

> Then here, do this...
> 
> $current_size = 0;
> while ( !feof($HANDLER) ) {
> 	$current_size += $buffer;
> 	echo fread($HANDLE, $buffer);
> }
> 
> Now, do what you want with $current_size
> 
> Maybe have a variable that you check it against that contains the users 
> allow amount of transfer...
> 
> $current_size = 0;
> while ( !feof($HANDLER) && $current_size < $allowed_limit ) {
> 	$current_size += $buffer;
> 	echo fread($HANDLE, $buffer);
> }
> 
> Hope this gets you leading down the right path...

Yes.  :-)

However, I do not want to break downloads...
So I check the $current_size AFTER each  completed  download  and  since
$USER can only download one file at once, it  should  work  without  any
problems.

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