Forum Moderators: coopster

Message Too Old, No Replies

ie6 shows "index" as filename

instead of real filename.

         

d40sithui

5:59 pm on Mar 5, 2008 (gmt 0)

10+ Year Member



Hey everybody. I'm struggling with this for a couple hours. again, the problem makes no sense so I came here. I have a download script that uses headers to offer the file for download.
here is the ending portion.

//set m-type
$mtype = '';
if($allowed_ext[$fext] == ''){
// mime type is not set, get from server settings
$mtype = mime_content_type($file_path);
}
else{
$mtype = $allowed_ext[$fext];
}
if ($mtype == '') {
$mtype = "application/force-download";
}
//echo "\$mtype : $mtype<br>"; //this prints out the correct mtype
//echo "\$fname: $fname"; //this prints out the correct file name

// set headers
@ini_set('zlib.output_compression', 'Off');
header("Pragma: public");
header("Expires: 0");
header('Cache-Control: no-store, no-cache, must-revalidate');
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: public");
header("Content-Description: File Transfer");
header("Content-Type: $mtype");
header("Content-Disposition: attachment; filename=\"$fname\"");
header("Content-Transfer-Encoding: binary");
header("Content-Length: " . $fsize);

// download
//@readfile($file_path);
$file = @fopen($file_path,"r");
if ($file) {
while(!feof($file)) {
print(fread($file, 1024*8));
flush();
if (connection_status()!=0) {
@fclose($file);
die();
}
}
@fclose($file);
}


Naturally, when evoked, the download box would pop up and the filename will be there. The problem is when ie6 tries to run the script. all files would be offered with the name "index" and no extensions unlike "file1.ppt" or "myfile.pdf", and so on.
$fname stores the filename. ie7 and ff works fine as they both show the real filename. anyone know whats going on?

d40sithui

2:02 am on Mar 6, 2008 (gmt 0)

10+ Year Member



you know i always submit these weird little problems and the culprit is always the same. stupid me.
for anyone's who's curious, the problem was at the variable $fname.
now, before all files were stored in one directory with no sub folders. since i added subfolders the $fname changed as well - yes it added the slash. ie6 didnt take kindly into that and i guess dealt with it in its own special way.
another lession learned...sigh.