Bman900 Posted July 3, 2010 Share Posted July 3, 2010 I have been searching google all day and can't seem to find one tutorial on creating a download script with PHP. Basically I want to download a file after it is checked if it exist. Any one have a suggestion? Link to comment https://forums.phpfreaks.com/topic/206596-simple-download-script/ Share on other sites More sharing options...
robert_gsfame Posted July 3, 2010 Share Posted July 3, 2010 u could try this Assume i have put all filetype($filetype) and filename($filename) in my database $array=mysql_fetch_array($myquery); $upload=$array['upload']; $filetype=$array['filetype']; $mimeType = $filetype; header('content-disposition: attachment; filename="' . $upload . '"'); header('content-type: ' . $mimeType); header('content-length: ' . filesize("foldername/{$upload}")); readfile("foldername/{$upload}"); Hope it helps.... Link to comment https://forums.phpfreaks.com/topic/206596-simple-download-script/#findComment-1080572 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.