I am trying to flush ouput cookies using the flush function. I have seen several different ways that people have used to flush their output buffers. None have seemed to work on my system. Output buffering is turned on in my php.ini. Here is a part of a code I am using that shows the output buffering. Can anyone suggest a better method of immediately flUshing the cookies?

ob_start();
setcookie("filedone1",$_FILES['upload1']['name'],"0","","www.crescendomusiconline.com","");
ob_flush();
ob_end_flush();
sleep(3);

Thanks in advance for any help that can be provided.

    You might try adding a flush() after the ob_flush(), as the server may do its own buffering which the flush() might or might not trigger (depending on the web server and whether it is configured to honor such a request).

      Yeah I tried that and I also tried rearranging the different output buffer calls as some sites such as php.net and other forums I've happened upon seem to have different ways of doing it. No matter what I do even if I just try to echo text instead, which I tried as a debugging option, figuring maybe the cookie was what was causing it, it still outputs all text at the end of my script. I can live without the cookie being set until the end of the script, but I would like it to be set in the beginning, or at least before the script ends. Thanks again for any help.

        I am also using Internet Explorer, which I see in some cases like flush() needs characters sent before it will output anything. I have tried putting in page breaks as well as just simple text as still nothing echoes until the end of the script. is there any particular order that the Ob_flush , ob_start, ob_end_flush have to be in in order for the output to be flushed properly?

          Write a Reply...