bob_the _builder Posted February 28, 2007 Share Posted February 28, 2007 Hi, The following code should get files from url and prompt download. file.php $file = '/home/fusion/public_html/uploads/'.$_GET['files'].''; if(!file_exists($file)) die("I'm sorry, the file doesn't seem to exist."); $type = filetype($file); $today = date("F j, Y, g:i a"); $time = time(); header("Content-type: $type"); header("Content-Disposition: attachment;filename=$filename"); header('Pragma: no-cache'); header('Expires: 0'); readfile($file); if i send the url as: file.php?1.zip which exists in the uploads folder I get prompted to download file called file.php Any ideas what the issue maybe? Cheers Link to comment https://forums.phpfreaks.com/topic/40477-using-headers-to-send-download/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.