By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,824 Members | 2,410 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,824 IT Pros & Developers. It's quick & easy.

Session Problem with Header

P: 150
i'm having problem with session_start() to force the browser to download file with this function:

function force_download($file){
if ((isset($file))&&(file_exists($file))) {
header("Content-type: application/force-download");
header('Content-Disposition: inline; filename="' . $file . '"');
header("Content-Transfer-Encoding: Binary");
header("Content-length: ".filesize($file));
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="' . $file . '"');
} else {
echo "No file selected";
force_download("EGYMIDICA 2008.pdf");
when i delete the session_start() function the browser download the file with no problem how can i solve this with session?
Dec 8 '07 #1
Share this Question
Share on Google+
2 Replies

Expert 5K+
P: 5,058

What is the problem?
Are you getting any errors?

As far as I can see, there is nothing wrong with that.
The only thing I can think of is that the session_start() function is generating a warning, in which case adding a @ sign in front of it may fix the problem.
Dec 9 '07 #2

P: 150
i need code that foce the Browser to download my file then redirct the page or close it how can i do that?
Dec 10 '07 #3

Post your reply

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