I need to use a script to load a file from the filesystem and send it to the browser, so i wrote this small routine:
session_start();
//Do some stuff with sessions here ...
$fp=fopen($HTTP_GET_VARS["filetoshow"],"r");
header("Content-type: " . $HTTP_GET_VARS["mimetype"]);
print fread($fp,filesize($HTTP_GET_VARS["filetoshow"]));
fclose($fp);
It works really fine for all kind of files if i remove the session handling stuff ( session_start, etc ... ) but when i use as showed only image files work. The header and location of other types are mixed up.
Any clue how can i solve this ?
-Paulo