Forums

Emailing Attachements

baxterdown 27 Feb, 2013
Hi Bob,

I'm creating a form where users are going to be able to attach a PDf or JPG file to a form. The file will email as an attachment to the form recipient. I need to confirm a couple of things to make sure I do this right:

1. In Events I first add an "Upload File" event, then I add a "Custom Code" event where I drop the code below from FAQs.

2. Here's the code from FAQs. The attachment field name is called "sale_certificate". I assume I replace all of "$my_file_name" with "$sale_certificate" right? And if so, what do I use for "$my_file_path"?

<?php
$form->files['my_file'] = array(
  'name' => $my_file_name
  'original_name' => '',
  'path' => $my_file_path.$my_file_name,
  'size' => '',
  'link' => str_replace(JPATH_SITE.DS, JURI::root(), $my_file_path.$my_file_name)
);
?>


Hope the above makes sense and that I'm doing this right!🙂

Regards,

Jose
GreyHead 04 Mar, 2013
Hi Jose,

Sorry, I missed this post.

If the file is uploaded from the form then you don't need any Custom Code. Please see this FAQ

Bob
baxterdown 04 Mar, 2013
Hi Bob,

That's exactly what I had done but it didn't work. That's why I started doing research to see if there was more to it. I'm gonna go undo all of the custom code and try again. Please stand by :mrgreen:

Jose
baxterdown 04 Mar, 2013
Hi Bob,

The mail is sending correctly, but it's not attaching the file... Here's what I have now:

PREVIEW
Upload file field configured with field name "sale"certificate"

EVENTS (On Submit)
Check ReCaptcha
Email to client configured with Attachments fields name set to "sale_certificate"
Email to customer configured with blank Attachments fields name
Show Thanks Message

What am I doing wrong?

Jose
GreyHead 04 Mar, 2013
Hi Jose,

I don't see an Upload Files action in the On Submit event.

Bob
baxterdown 04 Mar, 2013
I had it and deleted it! Ok, I'll put it back in. Any particular settings I should be concerned with?

J.
Max_admin 10 Mar, 2013
Hi Jose,

You need an "Upload files" action, with an "Event loop" action inside its "on fail" event, then you need to configure the files fields names setting in the "Upload files", please follow the info there, the string should be in this format:

field_name:extension1-extension2

This should upload the files, then you can configure the email attachments:
http://www.chronoengine.com/faqs/2676-how-can-i-attach-uploaded-files-to-an-email.html

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.