Not downloading in IE - works in FF
Posted: Mon Jul 17, 2006 12:38 pm
The following is a script used for downloading all kinds of documents. I did not write it. It works for Firefox, but in IE, it gives me an error: "the requested site is not available or cannot be found"
It is attempting to download over SSL
It is attempting to download over SSL
Code: Select all
if (isset($_GET['action']) && $_GET['action'] == "download")
{
session_cache_limiter("public, post-check=50");
header("Cache-Control: private");
}
//if (isset($session_save_path)) session_save_path($session_save_path);
if (isset($_GET['path'])) $path = validate_path($_GET['path']);
if (!isset($path)) $path = FALSE;
if ($path == "./" || $path == ".\\" || $path == "/" || $path == "\\") $path = FALSE;
if (isset($_GET['filename'])) $filename = basename(stripslashes($_GET['filename']));
if ($user->has_priv('dnld_file') || $user->has_priv('view_file'))
{
if (isset($_GET['filename']) && isset($_GET['action']) && is_file($GLOBALS['home_directory'] . $user->user_dir.$path.$filename) || is_file("../".$GLOBALS['home_directory'] . $user->user_dir.$path.$filename))
{
if (is_file($GLOBALS['home_directory'] . $user->user_dir.$path.$filename) && !strstr($GLOBALS['home_directory'] . $user->user_dir, "./") && !strstr($GLOBALS['home_directory'] . $user->user_dir, ".\\"))
$fullpath = $GLOBALS['home_directory'] . $user->user_dir.$path.$filename;
else if (is_file("../".$GLOBALS['home_directory'] . $user->user_dir.$path.$filename))
$fullpath = "../".$GLOBALS['home_directory'] . $user->user_dir.$path.$filename;
if (!$user->has_priv('dnld_file') && $user->has_priv('view_file') && !is_viewable_file($filename))
{
print "<font color='#CC0000'>$StrAccessDenied</font>";
exit();
}
header("Content-Type: ".get_mimetype($filename));
header("Content-Length: ".filesize($fullpath));
if ($_GET['action'] == "download" && $user->has_priv('dnld_file'));
header("Content-Disposition: attachment; filename=$filename");
readfile($fullpath);
}
else
print "<font color='#CC0000'>$StrDownloadFail</font>";
}