473,387 Members | 1,504 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

PHP progress bar?

HaLo2FrEeEk
404 256MB
Ok, I know ths is possible, an example is here:

http://www.johnboy.com/php-upload-progress-bar/

It uses the ob_flush() and flush() functions of PHP. From what I've read, these functions have no effect if mod_gzip is enabled in your apache server. I'm on a shared hosting plan with Dreamhost and they have mod_gzip enabled, but you can request to have it turned off for certain subdomains. I did so, but it seems that it didn't have an effect. Here is my code:

Expand|Select|Wrap|Line Numbers
  1. <?php
  2. ob_start();
  3.  
  4. for ($i = 0; $i < 5; $i++) {
  5.   echo $i . "<br>";
  6.   ob_end_flush();
  7.   ob_flush();
  8.   flush();
  9.   sleep(1);
  10.   ob_start();
  11.   }
  12.  
  13. ob_end_flush();
  14. ?>
This should output numbers from 0 to 5 over 5 seconds, sequentially, WHILE the page is loading. Instead it just takes 5 seconds for the page to load and then outputs the whole thing at once.

I need to know how to make this work. I have a script that can take 30-45 seconds to run and I want something for my users to look at. Using Flash really isn't an option because I don't know flash. I COULD use AJAX and simply send a request to another script, but I'd like to try to avoid anything that requires Javascript.

Please, if you guys could help me out, I'd be super grateful!
May 8 '10 #1
6 4016
chathura86
227 100+
please review that code properly

specially the APC part, which does the magic of sending the upload progress


Regards
May 8 '10 #2
HaLo2FrEeEk
404 256MB
Could you be a little more specific as to what I'm supposed to be looking at, everything looks right to me but it's not working, which is why I asked for help.
May 8 '10 #3
Markus
6,050 Expert 4TB
Do you have APC enabled?
May 9 '10 #4
HaLo2FrEeEk
404 256MB
I don't know what APC is. It sounds familiar, but refresh my memory, please.
May 9 '10 #5
chathura86
227 100+
All the details you need can be found in your tutorial

http://www.johnboy.com/php-upload-progress-bar/

for more info read the php manual

http://php.net/manual/en/book.apc.php

Regards
May 9 '10 #6
Markus
6,050 Expert 4TB
The Alternative PHP Cache extension. Apparently it is necessary for this library to work.
May 9 '10 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: SpamProof | last post by:
I got an animated gif that is a barber pole spinning that I want to use as a progress bar. The problem is that is stops spinning (shows 1 frame) when my browser is processing a submited request...
7
by: Pepi Tonas | last post by:
I have a form that takes some time to load because it has to populate some Data. I was trying to display a form on top of it with an activity bar so that user can see that something's going on. ...
1
by: scorpion53061 | last post by:
this code came from cor and I think Armin authored it. I am trying to download an access database and track its progress. It is reading the size fo the file but I am unsure of how to get the...
8
by: Brian Henry | last post by:
I created a smooth progress bar with this code.. but if you update the values in a row quickly of it and watch it on screen it flickers... how would i change this to reduce the flickering?...
8
by: WhiteWizard | last post by:
I guess it's my turn to ASK a question ;) Briefly my problem: I am developing a Windows app that has several User Controls. On one of these controls, I am copying/processing some rather large...
1
by: daniel_xi | last post by:
Hi all, I am running a VS 2003 .NET project on my client machine (Win 2000 SP4, ..NET framework 1.1), running an ASP.NET application on a remote web server (Win 2000 Server, IIS 6.0, .NET...
15
by: eladla | last post by:
Hi! I am creating a composite control the does some of it`s own data access. I want to display a progress bar between the time the page is loaded and the control place holder is displayed and...
5
by: Aggelos | last post by:
Hello I am doing sevreral scripts like sending a newsletter that might take a while to finish first to prevent the browser from timing out and to keep the user informed of the process progress I...
1
by: Bob | last post by:
Hi, I am having trouble seeing how this bolts together. The UI starts a process which involves a long running database update. All Database activity is handled by a class called DT. DT has a...
0
by: jags_32 | last post by:
Hello We use MFG-PRO as our ERP system which in turn uses Progress databases. In the old version of SQL 2000, using DTS packages, we used to set the code page via command prompts and execute DTS...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.