jsteiner87
Programmer
I am having problems with my download script and IE. If I use the download script above my browser asks me if I want to save it or open it. When I save it to my desktop it opens up with no errors. If I try to open it without saving it to the desktop, it gives me this error in Adobe. "There was an error opening this document. The file does not exist." When I try this in FireFox I don't get an error either way.
This is my download script in my header.
<?php
if(isset($_GET['id']))
{
$id = $_GET['id'];
mysql_select_db($database_conn, $database);
$query = "SELECT file_name, file_type, file_size, file_content FROM table WHERE id = '$id'";
$result = mysql_query($query, $database) or die(mysql_error());
list($name, $type, $size, $content) = mysql_fetch_array($result);
header("Content-length: $size");
header("Content-type: $type");
header("Content-Disposition: attachment; filename=$name");
echo $content;
exit;
}
?>
This is my download script in my header.
<?php
if(isset($_GET['id']))
{
$id = $_GET['id'];
mysql_select_db($database_conn, $database);
$query = "SELECT file_name, file_type, file_size, file_content FROM table WHERE id = '$id'";
$result = mysql_query($query, $database) or die(mysql_error());
list($name, $type, $size, $content) = mysql_fetch_array($result);
header("Content-length: $size");
header("Content-type: $type");
header("Content-Disposition: attachment; filename=$name");
echo $content;
exit;
}
?>