Hi.
I have used the multi-upload widget & my files are in the upload directory. I need to find out how to attach these uploads to my email that I am sending. I've tried attachments_1[] & attachments_1 but the files are not attached. What am I doing wrong?
Kind Regards
Aslam
I have used the multi-upload widget & my files are in the upload directory. I need to find out how to attach these uploads to my email that I am sending. I've tried attachments_1[] & attachments_1 but the files are not attached. What am I doing wrong?
Kind Regards
Aslam
Hi,
I have similar problem. Files are uploaded to server but not attached to an email:
I have such a widget:
Form method: File
Form tag attachment: enctype='multipart/form-data'
On submit event
------------------
Fields Configuration: attachments:dwg-dxf-jpg-gif-jpeg-png-bmp-doc-docx-rtf-txt-pdf-ppt-pps-ppsx-psd-xls-xlsx-zip-rar
Maximum Limit: 8
File ID: attachments
other fields are blank
Email configuration
---------------------
Attachments fields name: attachments
Debug
-------
Regards,
Michal
I have similar problem. Files are uploaded to server but not attached to an email:
I have such a widget:
echo HTML_ChronoForms::loadWidget($form, 'multi_upload', array (
'label_text' => 'Attachments',
'input_name' => 'attachments[]',
'limit' => '8',
'label_over' => '0',
'hide_label' => '0',
'data_path' => '',
'data_path_name' => '',
'data_path_original_name' => '',
'data_path_id' => '',
'validations' => '',
'instructions' => '',
'tooltip' => '',
'tag' => 'input',
'type' => 'widget',
'widget' => 'multi_upload',
'wf_key' => '8',
'name' => '',
)); ?>
Form method: File
Form tag attachment: enctype='multipart/form-data'
On submit event
------------------
Fields Configuration: attachments:dwg-dxf-jpg-gif-jpeg-png-bmp-doc-docx-rtf-txt-pdf-ppt-pps-ppsx-psd-xls-xlsx-zip-rar
Maximum Limit: 8
File ID: attachments
other fields are blank
Email configuration
---------------------
Attachments fields name: attachments
Debug
-------
Data Array:
Array
(
[chronoform] => Zapytanie
[event] => submit
[Itemid] => 684
[option] => com_chronoforms
[nazwa] => 4
[email] => 4
[adres] =>
[kod] =>
[telefon] =>
[multi_upload_limit_attachments] => 1
[skala] =>
[typ] =>
[project_desc] =>
[input_submit_10] => Wyślij zapytanie ofertowe
[d361e87504f36a30a3e969fc9d5478d8] => 1
[attachments] => Array
(
[0] => 20121205212159_about_4.png
)
[_PLUGINS_] => Array
(
[upload_files] => Array
(
[attachments] => Array
(
[0] => Array
(
[name] => 20121205212159_about_4.png
[original_name] => about_4.png
[path] => //components/com_chronoforms/uploads/Zapytanie/20121205212159_about_4.png
[size] => 12079
[link] => *****20121205212159_about_4.png
)
)
)
)
[chronoform_data] => Array
(
[cf_uid] => 8bc865deb05e0f62f46224dde5ef00a4
[cf_created] => 2012-12-05 21:21:59
[cf_created_by] => 0
[cf_ipaddress] => 83.31.156.242
[cf_user_id] => 0
[chronoform] => Zapytanie
[event] => submit
[Itemid] => 684
[option] => com_chronoforms
[nazwa] => 4
[email] => 4
[adres] =>
[kod] =>
[telefon] =>
[multi_upload_limit_attachments] => 1
[skala] =>
[typ] =>
[project_desc] =>
[input_submit_10] => Wyślij zapytanie ofertowe
[d361e87504f36a30a3e969fc9d5478d8] => 1
[attachments] => Array
(
[0] => 20121205212159_about_4.png
)
[_PLUGINS_] => Array
(
[upload_files] => Array
(
[attachments] => Array
(
[0] => Array
(
[name] => 20121205212159_about_4.png
[original_name] => about_4.png
[path] => //components/com_chronoforms/uploads/Zapytanie/20121205212159_about_4.png
[size] => 12079
[link] => *****20121205212159_about_4.png
)
)
)
)
[cf_id] => 51
)
[chronoform_data_cf_id] => 51
)
Validation Errors:
Array
(
)
Debug Data
Upload routine started for file upload by : attachments
//components/com_chronoforms/uploads/Zapytanie/20121205212159_about_4.png has been uploaded successfully.
email
10
Result
An email has been SENT successfully from*****
Body
Name*:4
Submitted by 83.31.156.242
Attachments
array ( )
Regards,
Michal
I also had the same problem implementing the multi-file upload widget: files would upload, but wouldn't attach to the email. I tried Max's suggestion in the post that Bob provided. It didn't work for me.
I'm pretty sure it's because the multi-file function stores the file data as a nested array, such that $form->files[$attachment]['path'] needs to be $form->files[$attachment][$kk]['path'].
Finally, I modified the file: /administrator/components/com_chronoforms/form_actions/email/email.php.
Scroll down to $email_attachments[]=array().
Modify that whole chunk (from $email_attachments[]=array() to $form->files[$attachment]['path'];}}} ):
There's probably a cleaner way, but this has worked for me.
Hope someone else will find it useful!
Also make sure as Bob and others have noted: under General tab of the form, enter Form Tag Attachment as enctype="multipart/form-data"
* in Preview -> Multi-Upload -> Configure -> Field Name should be yourarray[]
* in Events -> Multi Upload Files -> Configure -> Fields Configuration -> Array Fields, it should be just yourarray (no square brackets)
* in Events -> Email -> Configure -> Attachments Field Names should be yourarray
I'm pretty sure it's because the multi-file function stores the file data as a nested array, such that $form->files[$attachment]['path'] needs to be $form->files[$attachment][$kk]['path'].
Finally, I modified the file: /administrator/components/com_chronoforms/form_actions/email/email.php.
Scroll down to $email_attachments[]=array().
Modify that whole chunk (from $email_attachments[]=array() to $form->files[$attachment]['path'];}}} ):
$email_attachments = array();
if(strlen(trim($email_params->get("attachments", ""))) && !empty($form->files)){
$attachments = explode(",", $email_params->get("attachments", ""));
foreach($attachments as $attachment){
if(isset($form->files[$attachment])){
if (!$form->files[$attachment]['path']) {
$numattach = count($form->files[$attachment]);
for ($n=0;$n<$numattach; $n++){
$email_attachments[] = $form->files[$attachment][$n]['path'];}}
else {$email_attachments[] = $form->files[$attachment]['path'];}
}
}
}
There's probably a cleaner way, but this has worked for me.
Hope someone else will find it useful!
Also make sure as Bob and others have noted: under General tab of the form, enter Form Tag Attachment as enctype="multipart/form-data"
* in Preview -> Multi-Upload -> Configure -> Field Name should be yourarray[]
* in Events -> Multi Upload Files -> Configure -> Fields Configuration -> Array Fields, it should be just yourarray (no square brackets)
* in Events -> Email -> Configure -> Attachments Field Names should be yourarray
This topic is locked and no more replies can be posted.