Tracking file download progress
Tracking file download progress
am 24.12.2009 08:28:36 von Steel
Hi all!
Here is the problem: i have PHP script that takes URL of file from
client and downloads it to my server. But when file is downloading,
clients see blank page. How can I track file download progress on the
server side(easier) and send result to client lively, to show it like
a progress bar in web browser?
Googled around, found JQuery and JsHttpRequest, but can't understand
both for my task =3D) If everyone knows please give me some advice
Best regards
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Tracking file download progress
am 24.12.2009 09:47:04 von Daniel Egeberg
2009/12/24 STEEL :
> Hi all!
> Here  is  the  problem: i have PHP script that takes URL o=
f file from
> client  and  downloads  it  to  my server. But w=
hen file is downloading,
> clients  see blank page. How can I track file download progress on t=
he
> server  side(easier) and send result to client lively, to show it li=
ke
> a progress bar in web browser?
> Googled  around,  found  JQuery and JsHttpRequest, but can=
't understand
> both for my task =3D) If everyone knows please give me some advice
>
> Best regards
If I understand your question correctly, you cannot. PHP works on the
server-side so once you've sent your HTTP response request, you are no
longer in control. Besides, I don't know any downloading tool that
doesn't already show a progress bar to the user. Even wget does so.
You can of course track how much data *you* have sent, but that
doesn't mean the client has downloaded all of it. It may for instance
be that the client didn't finish downloading or that it is downloading
slower than you are sending.
--=20
Daniel Egeberg
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Tracking file download progress
am 24.12.2009 09:55:17 von Steel
> 2009/12/24 STEEL :
>> Hi all!
>> Here  is  the  problem: i have PHP script that takes URL =
of file from
>> client  and  downloads  it  to  my server. But =
when file is downloading,
>> clients  see blank page. How can I track file download progress on =
the
>> server  side(easier) and send result to client lively, to show it l=
ike
>> a progress bar in web browser?
>> Googled  around,  found  JQuery and JsHttpRequest, but ca=
n't understand
>> both for my task =3D) If everyone knows please give me some advice
>>
>> Best regards
> If I understand your question correctly, you cannot. PHP works on the
> server-side so once you've sent your HTTP response request, you are no
> longer in control. Besides, I don't know any downloading tool that
> doesn't already show a progress bar to the user. Even wget does so.
> You can of course track how much data *you* have sent, but that
> doesn't mean the client has downloaded all of it. It may for instance
> be that the client didn't finish downloading or that it is downloading
> slower than you are sending.
> --=20
> Daniel Egeberg
Thanks for response, but seems you haven't understood:
>> takes URL of file from client  and  downloads  it  t=
o  my server.
User don't download it at the downloading time to server, server gets
it thru PHP script and stores on itself!
ONly i want is understand how to show progress bar to user. I have an
idea: in my downloading script in cycle add $_REQUEST['completed']
with downloaded bytes, then at the client side via JavaScript(JQuery)
it will dynamically get data from backend variable. Would it work?
--=20
С Ñважением,
STEEL mailto:vlad62@mail.kna.ru
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Tracking file download progress
am 24.12.2009 10:29:33 von kranthi
I dont think the problem in discussion has a solution. Your idea can
probably work but I could not understand how $_REQUEST['compleated']
variable is populated.
However it suffers from 2 problems.
1. It consumes a lot of unnecessary bandwidth.
2. How are you going to initiate the download ?
That said, there is a work around of using server push technology. Of
course it does not work in IE though.
www.howtocreate.co.uk/php/serverpushdemo.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Tracking file download progress
am 24.12.2009 11:34:12 von Daniel Egeberg
On Thu, Dec 24, 2009 at 09:55, STEEL wrote:
> Thanks for response, but seems you haven't understood:
>>> takes URL of file from client  and  downloads  it  =
to  my server.
> User  don't download it at the downloading time to server, server ge=
ts
> it thru PHP script and stores on itself!
> ONly  i want is understand how to show progress bar to user. I have =
an
> idea:  in  my  downloading  script in cycle add $_REQ=
UEST['completed']
> with  downloaded bytes, then at the client side via JavaScript(JQuer=
y)
> it will dynamically get data from backend variable. Would it work?
Oh, I see now. Sorry.
I had this in my bookmarks: http://www.swfupload.org/
I don't know if it's any good, but you can check it out.
--=20
Daniel Egeberg
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Tracking file download progress
am 24.12.2009 12:01:48 von Steel
> On Thu, Dec 24, 2009 at 09:55, STEEL wrote:
>> Thanks for response, but seems you haven't understood:
>>>> takes URL of file from client  and  downloads  it =C2=
=A0to  my server.
>> User  don't download it at the downloading time to server, server g=
ets
>> it thru PHP script and stores on itself!
>> ONly  i want is understand how to show progress bar to user. I have=
an
>> idea:  in  my  downloading  script in cycle add $_RE=
QUEST['completed']
>> with  downloaded bytes, then at the client side via JavaScript(JQue=
ry)
>> it will dynamically get data from backend variable. Would it work?
> Oh, I see now. Sorry.
> I had this in my bookmarks: http://www.swfupload.org/
> I don't know if it's any good, but you can check it out.
> --=20
> Daniel Egeberg
Thanks all, I've found the solution! PHP Backend + JQuery works great!
And without "eating" lot of bandwith, graph updated only once per 2
seconds and data sent by server is only about 500 bytes
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Tracking file download progress
am 24.12.2009 15:19:18 von TedD
At 5:28 PM +1000 12/24/09, STEEL wrote:
>Hi all!
>Here is the problem: i have PHP script that takes URL of file from
>client and downloads it to my server. But when file is downloading,
>clients see blank page. How can I track file download progress on the
>server side(easier) and send result to client lively, to show it like
>a progress bar in web browser?
>Googled around, found JQuery and JsHttpRequest, but can't understand
>both for my task =) If everyone knows please give me some advice
>
>Best regards
>
Hi:
I usually solve that problem by presenting the user with an animated
wait gif -- here are some examples (use as you may):
http://webbytedd.com/bb/wait/
If you think about it, the user doesn't really need to know how much
has been downloaded. They just need to know that something is
happening and this does that.
Cheers and Merry Christmas.
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Tracking file download progress
am 25.12.2009 05:29:04 von kranthi
Just out of curiosity. Can you please tell me how you initiated the download?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Tracking file download progress
am 26.12.2009 02:31:13 von kranthi
> Thanks all, I've found the solution! PHP Backend + JQuery works great!
Just out of curiosity. Can you please tell me how you initiated the download?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Tracking file download progress
am 27.12.2009 07:02:58 von Steel
>> Thanks all, I've found the solution! PHP Backend + JQuery works great!
> Just out of curiosity. Can you please tell me how you initiated the downl=
oad?
Via JSHttpRequest( JQuery started to lie %) ) to PHP backend.... then , i=
n file downloading cycle there
are $GLOBALS['_FULL'] tells frontend complete size of the file, and
$GLOBALS['_GOT'] tells clientside how bytes are downloaded..all you
need from php is to disable output buffering,or it will not work!
And then, showing progress bar is just easy HTML & JS trick!
--=20
STEEL mailto:vlad62@mail.kna.ru
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php