eddiegster Posted September 2, 2007 Share Posted September 2, 2007 Hello, Put together this Download script which basically reads data from a mysql database and attempts to download the file to the user. I believe it does make the connection to the database, but does not return any data or dialogue to the user for the user to save. Am, I missing something here? Just a Php newbie. Thanks, Eddie <?php if ($id_files) { include "open_db.inc"; $sql = "SELECT bin_data, filetype, filename, filesize FROM tbl_Files WHERE id_files=$id_files"; $result = @mysql_query($sql, $db); $data = @mysql_result($result, 0, "bin_data"); $name = @mysql_result($result, 0, "filename"); $size = @mysql_result($result, 0, "filesize"); $type = @mysql_result($result, 0, "filetype"); header("Content-type: $type"); header("Content-length: $size"); header("Content-Disposition: attachment; filename=$name"); header("Content-Description: PHP Generated Data"); echo $data; Quote Link to comment https://forums.phpfreaks.com/topic/67633-troubleshooting-download-script/ Share on other sites More sharing options...
redbullmarky Posted September 2, 2007 Share Posted September 2, 2007 first off, i'd recommend (not just to you, but to everyone here) to seriously avoid the @ suppressor. If you have an error, the suppressor will hide it from you, making debugging 100x harder. So on the 5 lines that use it - remove it, run the script again, and post any errors you get here. this has nothing to do with OOP either so moving to PHP Help... Quote Link to comment https://forums.phpfreaks.com/topic/67633-troubleshooting-download-script/#findComment-339770 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.