I am currently working on a project that has files stored in a DB as blobs. I need to attach the file to an e-mail and send it out via PHPMailer. I am familiar with $mail->addAttachment()
, however, this function seems to take in a file path only, which I don't have. I was wondering if there is any way to manipulate the blob and feed to this function ?
I appreciate any suggestions, thanks in advance!
The following successfully creates a 'Save As' dialog of the file I need to attach:
header("Content-disposition: attachment; filename={$filename}.{$file_ext}");
header("Content-type: application/octet-stream");
echo $pdf['data'];
exit;