<![CDATA[ Adding a file from the server to eform as attachment - My Forums]]> https://forums.modx.com/thread/?thread=92435 <![CDATA[Adding a file from the server to eform as attachment]]> https://forums.modx.com/thread/92435/adding-a-file-from-the-server-to-eform-as-attachment#dis-post-505108
I tryed to add it in the files array, (this works that I get a file on my server) but how do I get this file attached with the send email?

This is what I did: i called the on eFormOnBeforeMailSent

<?php
function attachFile( &$fields ){

//...more pdf stuff...
$pdf->Output(MODX_BASE_PATH . 'assets/pdf/facturen/file.pdf', 'F');

$_FILES['attachment']['name'] = 'factuur123.pdf';
$_FILES['attachment']['error'] = 0;
$_FILES['attachment']['tmp_name'] = MODX_BASE_PATH . 'assets/pdf/facturen/file.pdf';
$_FILES['attachment']['size'] = filesize(MODX_BASE_PATH . 'assets/pdf/facturen/file.pdf');

return true;


the pdf is created but the file is not attached even tho i have a [+attachment+] placeholder in the report.

any idea how i can do this?
]]>
Dimmy Jul 30, 2014, 06:40 AM https://forums.modx.com/thread/92435/adding-a-file-from-the-server-to-eform-as-attachment#dis-post-505108
<![CDATA[Re: Adding a file from the server to eform as attachment]]> https://forums.modx.com/thread/92435/adding-a-file-from-the-server-to-eform-as-attachment#dis-post-505109
http://forums.modx.com/thread/46995/is-it-posible-to-atach-a-file-with-an-event

It was even a treat by my self that was answerd years ago.

But maybe its cool that if there will be a new eform that tis solution is added.]]>
Dimmy Jul 30, 2014, 07:18 AM https://forums.modx.com/thread/92435/adding-a-file-from-the-server-to-eform-as-attachment#dis-post-505109