I have several images to preload for a web page. I wrote a nice routine to show a progress bar and update it after each image is preloaded. Works great on my PC. (XP with IIS). The one thing I have to do is flush the buffer each time I update the progress bar to see the change on the screen.
When I copy this program up to the hosting server, Unix based http://www.fatcow.com, I get an error each time it hits the following command:
<? flush();ob_flush(); ?>
The error is:
Notice: ob_flush(): failed to flush buffer. No buffer to flush. in c:\inetpub\wwwroot\portfolio.php on line 158
If I leave out the ob_flush() and just use flush() I get no error message but it does not refresh the screen and show the progress.
Any help here would be greatly appreaciated.
TIA Frank
Problem with Flush() and Ob_Flush()
Moderator: General Moderators
For Apache Server flush() alone will do.
For IIS, I guess flush() is not working (dont know abt IIS 6 though) but ob_flush() does.
Really don't know how web servers handle these buffer flush methods but ob_flush() forces flushing of buffer and so the server may report an error when flush();ob_flush(); is used together.
If you are uploading to unix, just flush() will do the job.
For IIS, I guess flush() is not working (dont know abt IIS 6 though) but ob_flush() does.
Really don't know how web servers handle these buffer flush methods but ob_flush() forces flushing of buffer and so the server may report an error when flush();ob_flush(); is used together.
If you are uploading to unix, just flush() will do the job.
The error makes sense. Flushing sends everything in the output buffer, to the client. If you flush() the buffer, that empties it. Calling ob_flush() afterwards also flushes the buffer, and turns on automatic calling of flush() after every output call. The error is just saying there's nothing in the output buffer (since you've just flush()ed it)
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
-
malcolmboston
- DevNet Resident
- Posts: 1826
- Joined: Tue Nov 18, 2003 1:09 pm
- Location: Middlesbrough, UK