Forums

email attachments

fullfusion 08 Feb, 2011
I've set up a file upload field in my form, but how do I get an attachment to send in an email? My form sends the name of the form in the email, but it doesn't attach the actual file it.

Dan
GreyHead 08 Feb, 2011
Hi Dan,

In the latest RC1.4 release click the Email configuration (spanner) icon and on the General tab there's an "Attachments fields name" box that takes a comma separated list of the file input names you want to attach.

Bob
Max_admin 09 Feb, 2011
Hi Dan,

You should have a "Files upload" action and inside its success event or event after it (this depends on your needs) you should have the "Email" action and use the files fields names in the settings box as Bob mentioned.

You will have to "Edit" your form in normal mode later and set the "Form Method" to "File" so that your form is able to handle files uploads.

If you have any issues with this then please let us know because I may have to send you a patched file.

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
tmichels 10 Feb, 2011
I seem to have the same problem. It sends me an email with the field name that is supposed to be uploading the file in curly brackets but no attachment.

I set form method to file, upload files in on submit, my connection string is input_file_3:jpg-png-gif (input_file_3 is the file upload field name), i have on success set to email with attachment fields set to input_file_3 and i have {input_file_3} in the template, and send as HTML. On fail i have set to event loop on submit>upload files> onfail. any suggestions?

-Taylor

Edit: the images were uploaded to the database on the server so the problem is just in attaching it to the email.
GreyHead 11 Feb, 2011
Hi Taylor,

At first I couldn't get a file to upload at all - though I did get the file name in the email. After a while digging around I worked out that I had to add enctype='multipart/form-data' in the Form Tag Attachment box in the Forms Manager | General tab (this is no longer added automatically).

Now I can get the file uploaded . . . but it still isn't attached to the email and the file name no longer appears in the email - just the {input_name} again.

Bob

PS There is a small bug around ine 26 of administrator/components/com_chronforms/form_actions/upload_files/upload_files.php where $MyForm->xxx appears in place of $form->form_details (I forget exactly what the xxx part was). This prevents ChronoForms from creating the uploads folder if it doesn't already exist.
GreyHead 11 Feb, 2011
Hi Taylor,

I've found the attachment bug. At around line 150 of form_actions/email/email.php is this block of code
			foreach($attachments as $attachment){
				if(isset($form->files[$attachment])){
					$email_attachments[] = $form->files[$attachment]['path'].$form->files[$attachment]['name'];
				}
			}
this section .$form->files[$attachment]['name'] is missing from the end of the third line.

That just leaves the email substitution . . .

Bob
GreyHead 12 Feb, 2011
Hi Taylor,

And the substitution fix is in form_actions/upload_files/upload_files.php around line 90 where one extra line is required.
if($uploaded_file){
  $form->files[$file_data[0]] = array('name' => $file_name, 'path' => $upload_path, 'size' => $file_post["size"]);
  $form->data[$file_data[0]] = $file_name; // <-- add this line 
  $form->debug[] = $upload_path.$file_name.' has been uploaded OK.';
  $this->events['success'] = 1;
}else{
Once this line is added the file name substitution works in the Email and Thank you page code.

Bob
tmichels 15 Feb, 2011
That solved the problem. Thanks!

-Taylor
ronjb 28 Jun, 2013
Hi GreyHead,

I'm confused, I have the same problem.. theres no attachment and the field on the email is blank. I had place the field name on the "Attachments fields name" too.

Which should i modify? both the email.php and the upload_files.php, or just the upload_files.php? I tried adding

if($uploaded_file){
  $form->files[$file_data[0]] = array('name' => $file_name, 'path' => $upload_path, 'size' => $file_post["size"]);
  $form->data[$file_data[0]] = $file_name; // <-- add this line 
  $form->debug[] = $upload_path.$file_name.' has been uploaded OK.';
  $this->events['success'] = 1;
}else{


on my the line 90, which is only a } and i'm getting error once i submit the form..

Can you modify the upload_files.php and attach it once you fixed it please.. i'm really noob when it comes to php😢

Thanks in advance i hope you can help me here, or you can post a more detailed instruction please...
GreyHead 28 Jun, 2013
Hi ronjb,

This is a very old thread from an old release of ChronoForms. What exactly is the problem you have?

Bob
ronjb 29 Jun, 2013
Hi GreyHead,

Yes I'm still using the old Chronoforms Version 4.0, Everything works except the attachment file is not being sent along with the email i receive when a user submit the form.

The field that is the file upload element is {input_file_10}, and on the email it shows the filename.jpg but theres no attachment of the email, or link to it... I even added {input_file_10} to the Attachments fields name on the email config and the file uploads config is set to yes and files: input_file_10:jpg-png-gif

The uploaded image file is seen on the email but theres no image attached to the email..

What should i do to get this to work?

Thanks
GreyHead 29 Jun, 2013
Hi ronjb,

Please try input_file_10 without the curly brackets in the Email action Attachments box.

Bob
ronjb 29 Jun, 2013
Wow that solved it.. thanks for the help 😀

btw quick question, will ChronoForums_V1_RC5_J2.5_J3.0.zip work along with Chronoforms Version 4.0? or will it delete the forms that i just made?

Thanks a lot!
GreyHead 30 Jun, 2013
Hi ronjb,

As far as I know ChronoForums is completely separate and will not affect ChronoForms.

Bob
ronjb 30 Jun, 2013
Thanks just installed it and everything seems to be so easy to understand, except for this error "Access denied, you are not permitted to access this resource, please login." even though I'm logged in as a super user through login form on the front end, also tried creating a registered user type but still getting the same error..

I'll probably need to see a different forum category for this issue or make a new post..

Thanks again for the help..
GreyHead 30 Jun, 2013
Hi ronjb,

Please check the ChronoForums forum here. I'm not a ChronoForums user so can't help but there have been several posts there about permissions that Max (the developer) has replied to. It seems to me that you have to be pretty nit-picky about setting them up.

Bob
ronjb 01 Jul, 2013
Hi GreyHead

Thanks for all your help! i really appreciate it..:)

Yep its really difficult to get the permission settings to work or understand it.. anyways thanks for the info though..

God bless but i know a beer would be better, jst waiting for my bonus and i'll get you one
Thanks
This topic is locked and no more replies can be posted.