List Info

Thread: note 72772 added to function.session-write-close




note 72772 added to function.session-write-close
user name
2007-01-31 19:49:36
Along the same lines as what cenaculo at netcabo dot pt,
bkatz at usefulengineering dot com, and editorial at
literati dot ca said about making sure you
session_write_close(), don't forget to ob_end_flush() if
you're using output buffering.

I've been having some weird hanging issues when I tried to
navigate away from a page with content streaming in an
Iframe or a separate window.

Instead of:

<?
ob_start();
session_start();
/* Do session stuff here; security; logging; etc. */
session_write_close();
/* NOW write out the requested file. */
header("Content-type: audio/x-mpeg"); /* or
whatever type */
header("Content-Disposition: attachment;
filename=" . $filename);
header("Content-Length: " . $filesize);
header("Content-Transfer-Encoding: binarynn");
header("Pragma: no-cache");
header("Expires: 0");
$file_contents = file_get_contents($filepath);   
print($file_contents);
?>

Do:

<?
ob_start();
session_start();
/* Do session stuff here; security; logging; etc. */
session_write_close();
/* Make sure data is actually flushed out to the browser */
ob_end_flush();
/* NOW write out the requested file. */
header("Content-type: audio/x-mpeg"); /* or
whatever type */
header("Content-Disposition: attachment;
filename=" . $filename);
header("Content-Length: " . $filesize);
header("Content-Transfer-Encoding: binarynn");
header("Pragma: no-cache");
header("Expires: 0");
$file_contents = file_get_contents($filepath);   
print($file_contents);
?>
----
Server IP: 69.147.83.197
Probable Submitter: 74.99.232.47
----
Manual Page -- http://www.php.net/manual/en/function.session-write
-close.php
Edit        -- https://master
.php.net/note/edit/72772
Del: integrated  -- h
ttps://master.php.net/note/delete/72772/integrated
Del: useless     -- http
s://master.php.net/note/delete/72772/useless
Del: bad code    -- htt
ps://master.php.net/note/delete/72772/bad+code
Del: spam        -- https:/
/master.php.net/note/delete/72772/spam
Del: non-english -- 
https://master.php.net/note/delete/72772/non-english
Del: in docs     -- http
s://master.php.net/note/delete/72772/in+docs
Del: other reasons-- https://mast
er.php.net/note/delete/72772
Reject      -- https://mast
er.php.net/note/reject/72772
Search      -- https://
master.php.net/manage/user-notes.php

-- 
PHP Notes Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php


[1]

about | contact  Other archives ( Real Estate discussion Medical topics )