Hi,
Here's the sample code:
session_start();
header("Content-Type: $fileDataType");
header("Content-Length: $fileSize");
header("Content-Disposition: attachment; filename=$filename");
$q = "SQL TO GET DATA FROM DATABASE";
$r = mysql_query($q);
while ($ra = mysql_fetch_array($r)) {
echo $ra[fileData];
}
The code works fine when I remove the SESSION_START(); line...
BUT, I need it to do some security checks, as I make sure the logged in user has access to the file that is to be downloaded...
I can see that the session_start call is sending some headers that are screwing up the rest of the process....
When that line is in, the file name that "IE" prompts me to save is the PHP script file name... and not the actual filename that I want it to be called...
AGAIN, the script works fine when session_start is not used, but it is critical that I have it... or at least to be able to check a few access rights...
Any help is greatly appreciated!