i'm having problem with session_start() to force the browser to download file with this function:
[PHP]
session_start() ;
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($fil e));
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="' . $file . '"');
readfile("$file ");
} else {
echo "No file selected";
}
}
force_download( "EGYMIDICA 2008.pdf");
[/PHP]
when i delete the session_start() function the browser download the file with no problem how can i solve this with session?
[PHP]
session_start() ;
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($fil e));
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="' . $file . '"');
readfile("$file ");
} else {
echo "No file selected";
}
}
force_download( "EGYMIDICA 2008.pdf");
[/PHP]
when i delete the session_start() function the browser download the file with no problem how can i solve this with session?
Comment