email attachments

fullfusion , February 08 2011
f
fullfusion

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

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

admin

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

t
tmichels

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

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

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 [color=#000080].$form->files[$attachment]['name'][/color] is missing from the end of the third line.

That just leaves the email substitution . . .

Bob

GreyHead

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

t
tmichels

That solved the problem. Thanks!

-Taylor

r
ronjb

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 :cry:

Thanks in advance i hope you can help me here, or you can post a more detailed instruction please...

Attachments
upload_files.zip
(2.62 KiB)
203 Downloads/Views
GreyHead

Hi ronjb,

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

Bob

r
ronjb

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

Hi ronjb,

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

Bob

r
ronjb

Wow that solved it.. thanks for the help :D

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

Hi ronjb,

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

Bob

r
ronjb

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

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

r
ronjb

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

Powered by ChronoForums - ChronoEngine.com

ChronoForms Book

The ChronoForms Book, written for ChronoForms v3 contains 350 pages of invaluable ChronoForms How-tos hints and tips.

Note: many of the ideas can be used in ChronoForms v4 but the admin interface is very different and code examples may need to be modified.

SSL

Members Login

 

2CheckOut.com Inc. (Ohio, USA) is an authorized retailer for
goods and services provided by ChronoEngine.com