i store files on a file server and include the location and file name inside the database. When i attempt to download using the script below, the actual location of the file including the filename is WRITTEN inside the file(.i.e /work/files/example.txt). For instance, if i uplaoded a .txt file to the file server and attempted to download it, IE5 opens up the save as dialog box and when i open the file i get the full location and filename inside the txt file, previous contents that i wrote when creating the text file are not there.
<?php
include("dbconnect.php");
$query = "SELECT * FROM coursework_table WHERE coursework_id=$coursework_id";
$result = mysql_query($query);
$file=mysql_fetch_array($result);
$data = $file["fileloc"];
$name = $file["filename"];
$size = $file["filesize"];
$type = $file["filetype"];
header("Content-type: $type");
header("Content-length: $size");
header("Content-Disposition: attachment; filename=$name");
header("Content-Description: PHP Generated Data");
echo $data;
?>
I have read previous discussions on the forum and have tried removing the word 'attachment' along with the semi colon. No fix unfortunately.
Any Ideas?
IE5
PHP4