data["attachments"] as $attachment){ $email_attachments[] = $_SERVER["DOCUMENT_ROOT"].DIRECTORY_SEPARATOR.$attachment; }}.. just before JUtility::sendMail() by default or point me to a more elegant solution.Thanks in adavance,mplock"> Implement field array for attachments from multi uploader - Forums

Forums

Implement field array for attachments from multi uploader

mplock 06 Mar, 2012
Hello,

I just finished my work implementing plupload as custom field for multi uploads within chronoforms. Since I had to do a 'hack' in /administrator/com_chronoforms/form_actions/mail/mail.php to parse a field array for including the paths to the uploaded attachments I wanted to ask if its possible to implement a snippet like ...

if (isset($form->data["attachments"])) {
foreach($form->data["attachments"] as $attachment){
$email_attachments[] = $_SERVER["DOCUMENT_ROOT"].DIRECTORY_SEPARATOR.$attachment;
}
}

.. just before JUtility::sendMail() by default or point me to a more elegant solution.

Thanks in adavance,
mplock
Max_admin 17 Mar, 2012
Hi mplock,

I will add this to the to do list, you may also do it using some dynamic PHP code, alter the email action "attachments" setting and inject a list of dummy fields names and add your files paths under those names in the $form->files array.


<?php
//assuming your email action id is 55
$dummies = array('f1','f2','f3','f4');
$form->set('email_55', 'attachments', implode(',', $dummies));
foreach($dummies as $dummy){
$form->files[$dummy] = array('path' => FILE_PATH);
}
?>


The code above should go inside a Custom code action BEFORE your Email action.

Regards,
Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
This topic is locked and no more replies can be posted.