Hi, Thursday, September 16, 2004, 4:51:51 PM, you wrote: a> Hello PHP Users,
a> I have files (that protected from direct download) and I put it a> outside public_html/ directory (outside web server directory). a> and the people from outside could access the file by typing: a> www.myweb.com/download.php?filename=xzy.pdf a> can someone give me hint how to do this ? a> thank u a> -- a> Best regards, a> adwin a> www.kuya-kuya.net Something like this <?php //need to be careful of ../ in filename so use basename $filename = "/path/to/file/".basename($_GET['filename']); if(file_exists($filename)){ $len = filesize($filename); header("Content-type: application/pdf"); header("Content-Length: $len"); header("Content-Disposition: inline; filename=foo.pdf"); readfile($filename); } ?> -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php