LLLLLLL Posted August 26, 2010 Share Posted August 26, 2010 On MySQL 5.1.47, PHP 5.2.14 I have some PDFs stored in a database as BLOBs. Using PHP code, how can I attach these BLOBs to an email? Quote Link to comment https://forums.phpfreaks.com/topic/211821-blob-file-in-mysql-can-i-attach-to-an-email/ Share on other sites More sharing options...
Mchl Posted August 26, 2010 Share Posted August 26, 2010 Yes you can Quote Link to comment https://forums.phpfreaks.com/topic/211821-blob-file-in-mysql-can-i-attach-to-an-email/#findComment-1104126 Share on other sites More sharing options...
LLLLLLL Posted August 26, 2010 Author Share Posted August 26, 2010 Right... could you provide an example of how to do this? Is it necessary to turn the BLOB into a file and then attach it, or can the BLOB be attached directly? Quote Link to comment https://forums.phpfreaks.com/topic/211821-blob-file-in-mysql-can-i-attach-to-an-email/#findComment-1104127 Share on other sites More sharing options...
Mchl Posted August 26, 2010 Share Posted August 26, 2010 It can be attached directly. How exactly, depends on how you're sending your mails. Quote Link to comment https://forums.phpfreaks.com/topic/211821-blob-file-in-mysql-can-i-attach-to-an-email/#findComment-1104130 Share on other sites More sharing options...
LLLLLLL Posted August 26, 2010 Author Share Posted August 26, 2010 Hello again. I had planned on using the standard "mail" function: mail($to, $subject, $message, $from); Quote Link to comment https://forums.phpfreaks.com/topic/211821-blob-file-in-mysql-can-i-attach-to-an-email/#findComment-1104194 Share on other sites More sharing options...
LLLLLLL Posted August 28, 2010 Author Share Posted August 28, 2010 I've looked all around for the answer on this, and I still cannot find it. I'm most confused about getting the file out of the database and turning it into a stream of data to attach. fread() and fopen() don't work because they require file paths. :'( Quote Link to comment https://forums.phpfreaks.com/topic/211821-blob-file-in-mysql-can-i-attach-to-an-email/#findComment-1104544 Share on other sites More sharing options...
fenway Posted August 30, 2010 Share Posted August 30, 2010 There must be countless tutorials on this -- no different than an image. Quote Link to comment https://forums.phpfreaks.com/topic/211821-blob-file-in-mysql-can-i-attach-to-an-email/#findComment-1105223 Share on other sites More sharing options...
LLLLLLL Posted August 30, 2010 Author Share Posted August 30, 2010 There really aren't. I've looked everywhere, and I only asked here because there was nothing to find. As it is, I'm now using PHPMailer to attach real files -- not storing files in the database. Quote Link to comment https://forums.phpfreaks.com/topic/211821-blob-file-in-mysql-can-i-attach-to-an-email/#findComment-1105229 Share on other sites More sharing options...
fenway Posted August 30, 2010 Share Posted August 30, 2010 Then you don't know where to look -- see here. Quote Link to comment https://forums.phpfreaks.com/topic/211821-blob-file-in-mysql-can-i-attach-to-an-email/#findComment-1105234 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.