Forums

Sending file on server as attachement

Erik66 31 Jul, 2015
Hello,

I'm trying to send an email from a form with a file that already resides on the server as attachement. The attachement is a 'tems and conditions' file in PDF format, the form a booking reauest for a travel agency.

The default email action has the option to send a attachment by naming the field name (of the field typ file) . So, I created a file type field in the form and put it as 'hidden' to force the form to have a file field. I worked out the form and put a little bit of custom code in the actions:

<?php
$form->data['attachment1'] = '/absolute/server/path/to/file/terms-and-conditions.pdf';
?>


With a debugger I see the value of form->data['attachment1'] is correctly filled after submit.

However, I do not get an email with the attachement. I tried a few things, like not specifying the absolute file path to the attachment file and placing it in the 'uploads' folder of the CF component. or filling in the filename as 'ghost' value in the field. I tried with and without handling the array. None worked.

I'm a bit out of options and thoughts. Anyone have an idea what I may be doing wrong?

Many thanks in advance from

Erik
Erik66 01 Aug, 2015
Thanks Geyhead, that solved it instantly! Great🙂

Best regards,

Erik
rarroso 28 Aug, 2015
Hi.

I´m using the solution posted here https://www.chronoengine.com/faqs/70-cfv5/5224-how-c%3Cspan%20class= but did not working

I´m using absolute file path but no file sended

I obtain this error code

Array
(
[archivo] => Array
(
[path] => http://www.congresologisticaunadm.com/archivos/presencial/Legal_Corruption.pdf
)

)
Errors
Array
(
)

i´m missing something?
GreyHead 29 Aug, 2015
Hi rarroso,

You need to add a server folder path - not a URL

Bob
This topic is locked and no more replies can be posted.