Thu Apr 17, 2014, 3:30 pm
Showing 1 to 10 of 17 entries.
Tue Feb 8, 2011, 9:27 am

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

70
Sat Dec 27, 2008, 5:11 am
Tue Feb 8, 2011, 9:44 am

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


ChronoForms technical support
If you'd like to buy me a coffee, thank you very much

GreyHead
Moderator
35685
Tue May 29, 2007, 6:15 pm
Wed Feb 9, 2011, 8:19 am

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


If your main question got answered then please select the answer using the GREEN button!

admin
Moderator
10210
Mon Aug 14, 2006, 1:29 am
Thu Feb 10, 2011, 8:19 pm

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.

4
Tue Feb 8, 2011, 10:41 pm
Fri Feb 11, 2011, 8:39 pm

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.


ChronoForms technical support
If you'd like to buy me a coffee, thank you very much

GreyHead
Moderator
35685
Tue May 29, 2007, 6:15 pm
Fri Feb 11, 2011, 8:54 pm

Hi Taylor,

I've found the attachment bug. At around line 150 of form_actions/email/email.php is this block of code

Code: Select all
   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


ChronoForms technical support
If you'd like to buy me a coffee, thank you very much

GreyHead
Moderator
35685
Tue May 29, 2007, 6:15 pm
Sat Feb 12, 2011, 7:09 am

Hi Taylor,

And the substitution fix is in form_actions/upload_files/upload_files.php around line 90 where one extra line is required.

Code: Select all
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


ChronoForms technical support
If you'd like to buy me a coffee, thank you very much

GreyHead
Moderator
35685
Tue May 29, 2007, 6:15 pm
Tue Feb 15, 2011, 7:06 pm

That solved the problem. Thanks!

-Taylor

4
Tue Feb 8, 2011, 10:41 pm
Fri Jun 28, 2013, 8:24 pm

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

Code: Select all
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...

27
Sat Mar 2, 2013, 7:16 am
Fri Jun 28, 2013, 9:51 pm

Hi ronjb,

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

Bob


ChronoForms technical support
If you'd like to buy me a coffee, thank you very much

GreyHead
Moderator
35685
Tue May 29, 2007, 6:15 pm
Showing 1 to 10 of 17 entries.

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