tags:

views:

37

answers:

1

Hello,

I have a upload script, working fine. But I cannot seem to get an output to the user saying, record 1 of 10 files uploaded.

I could do something like record 1 of 10 files uploaded record 2 of 10 files uploaded record 3 of 10 files uploaded record 4 of 10 files uploaded ...

.. record 10 of 10 files uploaded

which is easy.

How do I increment the number like uploading x 0f 10 where x increments only using php.

Thanks Jean

A: 

How do I increment the number like uploading x 0f 10 where x increments only using php.

Since PHP script is a server-side program, which only generates response on client request, the answer is, there's no way to do it ONLY with PHP.

You need to use some client-side scripting (javascript), which will make periodic requests to your server and obtain current status. Good idea is to use some AJAX framework (jQuery). Also, I suppose, there are already some solutions, since the problem seems rather common.

I'm not a jQuery specialist, but simple search resulted in the following article: http://t.wits.sg/2008/06/25/howto-php-and-jquery-upload-progress-bar/

Kel