views:

431

answers:

2

Hi all,

I want to create Upload Progress bar Using simple and pure PHP

Thanks in Advance NewBie

+3  A: 

You won't be able to do that in "pure PHP" (nor "simple", I'm afraid) without at least installing a PHP extension -- like :

  • APC (manual), which has support for upload progress -- but does many other things
  • Or uploadprogress -- which might be a better choice if you only want to add an upload bar, and not get the other things APC can get you.

Of course, this means you need to be administrator of your server, to install one of those.

And here's a blog-post about uploadprogress ; and here is an article based on APC.

Pascal MARTIN
i am having APC installed...
NewBie
That's good news, then ! (I saw your comment about Javascript to another answer : you won't have much of a choice, to get data from the server while the upload is in progress, you'll have to make some kind of frequent call from the browser to the server -- and, to do that, you'll need some portion of Javascript...)
Pascal MARTIN
what kind data i need to retrive from server....do you have any idea or demo code....
NewBie
The data you need to retrieve is the "progress" information : uploads are done to the server (on which you have APC installed), and you want to know how much of the file's data has been uploaded (which is an information APC gives you) ;; that information is on the server (i.e. accessible only via PHP + APC) ;; and you want to display it in the client (the browser) ;; which means you need to make calls from the client to the server to fetch it. ;; for demo/code, did you take a look at the article I pointed to in my answer ?
Pascal MARTIN
A: 

PHP 5.2+ supports upload progress. See this article

menkes
This requirement **asynchronous javascript** to `fire` every 100 ms and updates the progress bar, which is not *pure PHP*
rockacola
In that case nothing would satisfy the requirement, as the progress bar has to be shown in a browser at some point, which requires a level of browser scripting and/or interactivity.
Alan Storm