Forums

UPDATING JOOMLA 5 - MATTERS WITH ATTACHMENTS ON EMAIL (NO DATA FROM FORMS)

Tafrishi 01 Mar, 2019
hello everybody, I'd like to know the following things about Chronoforms, maybe you can help me:- if I update my version (5.0.14), will my data (tables with records) be kept? I want to be sure about not loosing them;-
i have found some matters at adding attachments on the email action. I
don't need to use data taken through the form, I just want to send pdf
file saved on joomla 3.x. I have used FAQs and internet guides, but no
working solutions. The custom code that I have used is put in the "on
submit" section in "setup", as follow:[pre]<?php
$path = JPATH_SITE.'/components/com_chronoforms5/uploads/folder/';
$form->files['object_name_put_in_attachment_box']['path'] = $path.'real_name_of_PDF_file.pdf';
?>
[/pre]
and in the attachment email box i have put:

object_name_put_in_attachment_box
[br]Considering that email is working in any case, if I try to add this attachment, no attachment is sent. Can you help me?[br]Thank you for the time spent and hoping to find a way to resolve this matter.[br][br]
Max_admin 02 Mar, 2019
Hi Tafrishi,

The data tables should not be affected!

Do you have a file named:
/components/com_chronoforms5/uploads/folder/real_name_of_PDF_file.pdf
?? if the file does not exist then it will not be attached!

Best regards
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Tafrishi 02 Mar, 2019
Answer
1 Likes
I've solved the problem!!

My error was on "slashes", because I forgot some of them. As guide I followed the FAQ at https://www.chronoengine.com/faqs/70-chronoforms/cfv5/5224-how-can-i-attach-files-from-my-server-to-an-email-in-cfv5 where codes could be misunderstood. In particular, the suggested code, whitch has to be put in a "custom code" block before the "email" action, is:
<?php
$path = JPATH_SITE.'/components/com_chronoforms5/uploads/folder_name/';
$form->files['field_name']['path'] = $path.'file_name.jpg';
?>
I made the following changes:
<?php
$path = JPATH_SITE.'/components/com_chronoforms5/chronoforms/uploads/allegati/';
$form->files['field_name']['path'] = $path.'prepara_la_pasta_alla_carbonara.pdf';
?>
where:
- the path now exists (I could have chosen another arbirtrary path);
- ".../allegati/" is a folder created by me. Here I saved the file I wanted to sent. My error was to forget the final slash;
- 'prepara_la_pasta_alla_carbonara.pdf' is the real name of the attached file, in my case a pdf file;
- field_name is the name whitch is put in the "email" action, in the "attachment field".
So now It works.

Very thank you for your help and speed.

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