bindiya Posted December 9, 2010 Share Posted December 9, 2010 I have a webpage where the candidates can attach their resumes and send to the admin.These attachments are saved in the mysql db as blob datatype.In another webpage the admin needs to download all this resumes and see the content. How will i code for that. Quote Link to comment Share on other sites More sharing options...
Buddski Posted December 9, 2010 Share Posted December 9, 2010 Do you store the file extension in the database aswell? All you really need to do is create a file called something like download.php that will connect to the mysql and echo out the data after you have sent some headers.. Here is what I have used in the past: header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename='.$the_file_name; header('Content-Transfer-Encoding: binary'); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); echo $data_from_sql; Quote Link to comment Share on other sites More sharing options...
bindiya Posted December 9, 2010 Author Share Posted December 9, 2010 yes i save the extensions also in the database Quote Link to comment Share on other sites More sharing options...
Buddski Posted December 9, 2010 Share Posted December 9, 2010 Ok then.. <?php // download.php example file // The query will need to be adjusted obviously $user = 'Bob'; $sql = "SELECT `ext`, `blob` FROM `downloads` WHERE `user` = '".$user.'"; $sql_query = mysql_query($sql); $data = mysql_fetch_array($sql_query); $the_file = $user . 'CV.' . $data['ext']; header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename='.$the_file; header('Content-Transfer-Encoding: binary'); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); echo $data['blob']; exit; ?> Quote Link to comment 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.