Page 1 of 1

Add Attachments from DB

Posted: Thu Apr 03, 2008 2:46 am
by abax
Hello! :D

I have a problem... I need to attach some files directly from a DB (stored with a base64 codify etc..) , if possible without creating the file on my file system.

There is a function that allow this operation?

Re: Add Attachments from DB

Posted: Thu Apr 03, 2008 6:35 am
by Chris Corbyn
Yes, just do it the same as usual but replace "new Swift_File()" with the raw data.

For example, if I wanted to "attach" a text file (using text as the example because it's obvious to give an example for) then I can do:

Code: Select all

$message->attach(new Swift_Message_Attachment('Contents of my imaginary text file', 'filename.txt', 'text/plain'));