data['contactname']; - USE DUMMY DATA ABOVE */// saving it in the file$file = fopen ($filepath . $filename, 'w');fwrite ($file, $csv_row);fclose ($file);// adding the file to the email as attachment/* set up files_array for the Email action. */$files_array = array ( 0 => $filepath . $filename;);$form->data['file_array'] = $files_array;// csvfile is referenced in Attachment field of Email $form->files["csvfile"]["path"] = $filepath . $filename;?>Debugger output is Email] => Array ( [0] => An email with the details below was sent successfully: [1] => To:myemail@gmail.com [2] => Subject:Wellesley STEM Expo Exhibitor Confirmation [3] => From name:Wellesley STEM Expo [4] => From email:wellesleystemexpo@gmail.com [5] => CC: [6] => BCC: [7] => Reply name: [8] => Reply email: [9] => Attachments:---"> form data in csv file for email attachment - Forums

Forums

form data in csv file for email attachment

spso 30 Sep, 2014
Hi I'm using v5 to create a csv file and attach it to an email. Have read posts and FAQs but. debugger output shows attachment field blank. I added the following Custom Code to create a file and set it the absolute path in $form->files["csvfile"]["path"] . Then {csvfile} is set as the attachment.

Am I going about this the correct way? Thanks for your help
This is the URL of the form: http://www.wellesleyeducationfoundation.org/index.php?option=com_chronoforms5

<?php
// write data to csv file
$filename = 'exhibitregister.csv';
$filepath='/home5/supportw/public_html/wef2013/tmp/';
// creating the CSV row
$csv_row = "test output";
/*$csv_row = $form->data['organzationname'] . "," . $form->data['contactname']; - USE DUMMY DATA ABOVE */
// saving it in the file
$file = fopen ($filepath . $filename, 'w');
fwrite ($file, $csv_row);
fclose ($file);
// adding the file to the email as attachment
/* set up files_array for the Email action. */
$files_array = array (
  0 => $filepath . $filename;
);
$form->data['file_array'] = $files_array;

// csvfile is referenced in Attachment field of Email 
$form->files["csvfile"]["path"] = $filepath . $filename;
?>


Debugger output is
Email] => Array
                (
                    [0] => An email with the details below was sent successfully:
                    [1] => To:myemail@gmail.com
                    [2] => Subject:Wellesley STEM Expo Exhibitor Confirmation
                    [3] => From name:Wellesley STEM Expo
                    [4] => From email:wellesleystemexpo@gmail.com
                    [5] => CC:
                    [6] => BCC:
                    [7] => Reply name:
                    [8] => Reply email:
                    [9] => Attachments:

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