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? Quote 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.... Quote Link to comment https://forums.phpfreaks.com/topic/206596-simple-download-script/#findComment-1080572 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.