I want to simply bring up a save as dialog box here. What is currently happening is the file is being downloaded to the browser without asking first, then when it is done it asks if I would like to save or not.
Here is my code:
$file_id =$_GET ['file_id'];
$sql = "SELECT str_file_name, int_file_size, str_file_type FROM tbl_file WHERE int_file_id='".$_GET['fileID']."'";
$result=mysql_query($sql) or die("Could not pull from tbl_file: ".mysql_error());
$row=mysql_fetch_array($result);
$filename = $row['str_file_name'];
$size = $row['int_file_size'];
$type = $row['str_file_type'];
// get the file data
$query = "SELECT bin_data FROM tbl_data WHERE int_file_id = '".$_GET['fileID']."' ORDER BY int_data_id";
$result = mysql_query($query);
// decode the fragments and recombine the file
$data = "";
while ($row = mysql_fetch_array($result)) {
$data .= base64_decode($row ["bin_data"]);
}
// output the file
header('Pragma: public');
header ("Content-type: $type");
header ("Content-length: $size");
header ("Content-Disposition: outline; filename=".$filename);
header ("Content-Description: PHP Generated Data");
echo $data;
I've been stumped on this for hours, any help is appreciated.