Re: Re: How to count transfered kBytes in File-Download
| From: | Ashley Sheridan | Date: | Sat, 03 Jan 2009 14:23:54 +0000 |
| Subject: | Re: Re: How to count transfered kBytes in File-Download | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-285398@lists.php.net to get a copy of this message | ||
On Sat, 2009-01-03 at 13:27 +0100, Michelle Konzack wrote:
> 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
>
>
I don't think this is actually possible. I've never seen it happen
before. It would need some sort of dedicated client-side software to
recognise exactly how much has been downloaded and then request the rest
of it. A browser doesn't yet have this capability I believe.
Ash
www.ashleysheridan.co.uk