<?php if(!$file) return false; /* properly verify filename as well this is just a demo script as is this is a huger security hole */
header("Content-disposition: attachment; filename=$file");
header('Content-type: application/pdf;'); /* application/octet_stream etc or pull the content type from your database as a variable or a list etc */
readfile("$file");
?>
the code above is an example of a force download script described by Death
savefile.php
usage
<a href='filesave.php?file=thisfile.ext'>download thisfile.ext</a>
Last edited by almostbob; Mar 21st, 2009 at 12:36 am.
Reputation Points: 562
Solved Threads: 368
Posting Maven
Offline 2,970 posts
since Jan 2009