I am working on a page to upload files to my server and then download files from my server. The upload works fine, when a file is uploaded the file name is added to a mySQL database. The download page queries the DB and pulls all of the file names into a dropdown box. I want the user to select a file name from the drop down and then click the download button and the file will ask were to download and then download...
I have it to a point using this -
if($POST['submit'] == 'DOWNLOAD') {
$file_name = $POST['hidden_file'];
$file = '/home/concept/www/uploads/'.$file_name;
$filename="$file_name"; // the name the file will have on client computer
$file_to_download="$file"; // the name the file has on the server (or an FTP or HTTP request)
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-Type: application/octet-stream");
header( "Content-Disposition: attachment; filename=\"$filename\"");
header( "Content-Description: File Transfert");
@readfile($file_to_download);
but that downloads the file and the code of the page you are viewing...
Any thoughts
~DE2