id;$MyUploads =& CFUploads::getInstance($form_id);$MyUploads->attachments = array(JPATH_SITE.DS.'images'.DS.'stories'.DS.'Your_Folder_Name'.DS.'Your_File_Name');?>The array is the absolute path to the file. In Joomla 1.5, the default location is most commonly, "images/stories/Your_Folder_Name/Your_File_Name.jpg" for example.You could also use the absolute path for your Joomla 1.5 which can be found in the admin Global Configurations under System. You can view the absolute path used for your logs file.The code for that would be:formrow->id;$MyUploads =& CFUploads::getInstance($form_id);$MyUploads->attachments [] = '/your_absolute_path/images/stories/your_folder/your_file';?>Finally, make sure "Enable Attachments" is set to "YES" in your Email Properties under the "Setup Email" tab.You can now attach documents or images to your user's email address (Dynamic To) using ChronoForms! Sweet!"> How to Add Email Attachments to your ChronoForms - Forums

Forums

How to Add Email Attachments to your ChronoForms

jstratos 27 Feb, 2010
Here's a great way to add email attachments to your Chronoforms in Joomla v1.5. Place this code in your, "On Submit code - BEFORE sending email:" under the FORM CODE tab:

<?php
$MyForm =& CFChronoForm::getInstance('Your_Form_Name');//Replace with Your Form name
$form_id = $MyForm->formrow->id;
$MyUploads =& CFUploads::getInstance($form_id);
$MyUploads->attachments = array(JPATH_SITE.DS.'images'.DS.'stories'.DS.'Your_Folder_Name'.DS.'Your_File_Name');
?>

The array is the absolute path to the file.

In Joomla 1.5, the default location is most commonly, "images/stories/Your_Folder_Name/Your_File_Name.jpg" for example.

You could also use the absolute path for your Joomla 1.5 which can be found in the admin Global Configurations under System. You can view the absolute path used for your logs file.

The code for that would be:

<?php
$MyForm =& CFChronoForm::getInstance('Your_Form_Name');//Replace with Your Form name
$form_id = $MyForm->formrow->id;
$MyUploads =& CFUploads::getInstance($form_id);
$MyUploads->attachments [] = '/your_absolute_path/images/stories/your_folder/your_file';
?>


Finally, make sure "Enable Attachments" is set to "YES" in your Email Properties under the "Setup Email" tab.

You can now attach documents or images to your user's email address (Dynamic To) using ChronoForms! Sweet!
customhost 24 May, 2010
I really wonder why nobody already thanked you for this posting! This is awesome!

I recently needed to create a ChonoForm for a client of mine where an XML file is generated and sent by email. This is exactly the piece of code I was looking for all the time.

So thank you very much for sharing!🙂

Cheers,
Eric
misfit 04 Jul, 2010
Hello and thank you for this post. I have a form with 4 Checkboxes (each box for a different info pdf document). So i have 4 Attachment-PDFs that i want so send to the User. But i want to send only that one (or two or threee ...) that was checked before in the Form. Do you know how i can realize that?
GreyHead 04 Jul, 2010
Hi misfit,

There was a thread about this a few weeks ago - if you search here on attachments you should find it.

Bob
misfit 06 Jul, 2010
Hi Bob, thanks for your reply. i searched 26 pages of the searchresult ("attachments") without success. perhaps i'm to blind to find the right post. can you give me a little hint where i can find it? that would be great. sorry, i really tried to find it for 1 1/2 hour (the whole match Niederlande vs. Uruguay) but find no solution.
baljee 04 Jan, 2012
Is there a maximum filesize? I am trying to add an attachement and with a small file, there is no issue but with a 500kb pdf the attachement does not send.

Any help? I am using the above method.
GreyHead 04 Jan, 2012
Hi baljee,

There is no limit to the attachment size in ChronoForms and I would not expect a 500kb file to cause any problems. Please double-check that you have the file name and path correct.

Bob
cb1 08 Feb, 2012
Would this also work for exporting a csv file?
This topic is locked and no more replies can be posted.