Files are uploading fine but nothing is attached to email.
I read the tutorial, followed all the steps, file uploads to server, all emails set to receive attachments, attachments are on, file uploads fine, form tag enctype="multipart/form-data" set, email shows filename matching filename on server :
20090419230042_TestWordUpload.docx
Debug Output:
1. Form passed first SPAM check OK
2. Form passed the submissions limit (if enabled) OK
3. Form passed the Image verification (if enabled) OK
4. Form passed the server side validation (if enabled) OK
5. $_POST Array: Array ( [FirstName] => s [LastName] => s [Degree] => MD [DegreeOther] => s [Specialty] => Cosmetic Surgery [SpecialtyOther] => s [Title] => s [Affiliation] => s [Phone] => s [Fax] => s [Email] => [email]fgeluso@ymail.com[/email] [237ac7e35821f05d6a26f9b731b7744d] => 1 )
6. $_FILES Array: Array ( [CVUpload] => Array ( [name] => Test Word Upload.docx [type] => application/vnd.openxmlformats-officedocument.wordprocessingml.document [tmp_name] => /tmp/phpLSA9xO [error] => 0 [size] => 9897 ) )
7. /home/palette/public_html/components/com_chronocontact/uploads/JoinOurFaculty/20090419230042_TestWordUpload.docx has been uploaded OK
8. Form passed the plugins step (if enabled) OK
9. An email has been SENT successfully from (GTPalette Resources Web Site)system@highmountaininternet.com to [email]frank@hmiexch.com[/email]
10. Debug End
11.
Redirect link set, click to test:
/
Thanks!
Frank
I just ran a test on a simple form here with the same result. Looks like something is broken in RC 4.11. I'll take a look once I've had some morning coffee.
Bob
I tested - there is a bug in RC4.11.
If you change the form name after the form is created, or you set a custom upload file path then ChronoForms will not correctly attach the file.
The fix is to open components/com_chronocontact/libraries/chronoformuploads.php and look right near the end for this line
$attachments[$allowed_s2[0]] = JPATH_COMPONENT.DS.'uploads'.DS.$MyForm->formrow->name.DS.$filename;
and replace it with this version
$attachments[$allowed_s2[0]] = $uploadpath.$filename;
Bob
Thanks for checking but still not working for me. I even created a brand new form. Changed nothing as far as form name, filename , path etc. and same results .. uploads fine. Just shows name of file in email. Checked everything over again. Check server logs as well. Any thinkg else I can do to help debug?
Thanks Again, Frank
Even though the select box said "yes" for the "ebable attachments" in MySQL the attribute read enable_attachments=0.
So I went to back end set to "no" and apply then save then set to "yes" and apply and save, looked at the DB and setting was good (=1). Re-Tested the foram and BINGO!🙂 all is well.
Thanks AGain for your awesome componant. Help this post helps.
Frank.
I wanted to double check here to make sure the "Form tag attachment" input should be "enctype="multipart/form-data", as described in the tutorial PDF. I ask because I don't recall adding this yesterday and I was still getting file attachments in my email OK. I added the code today when I started having the trouble. Assuming this is correct, anything else I can try to fix the problem?
This is really odd because yesterday I had no trouble making a form that could send me email attachments and then today that option has vanished. The only thing I did different today was making some edits on my form and also installing the CF Plugin. Thinking that my first form might be corrupted I created a brand new simple upload form from scratch and it had the same problem... no file attachments.
My next step is to uninstall everything and recreate what I did yesterday to get a working form and email attachment.
Please turn on Debug on the General Tab and show us a screen shot of the info you see when you submit the form.
The enctype is correct - but in the current versions ChronoForms will try to insert that automatically.
Bob
Form passed first SPAM check OK
Form passed the submissions limit (if enabled) OK
Form passed the Image verification (if enabled) OK
Form passed the server side validation (if enabled) OK
$_POST Array: Array ( [name] => Joe Tester [radio0] => Yes [button_3] => Submit [4f493294bbbbf77387b828def302ae8f] => 1 )
$_FILES Array: Array ( [photo] => Array ( [name] => 032209_ 006_sm.JPG [type] => image/pjpeg [tmp_name] => /tmp/phphmg0l5 [error] => 0 [size] => 177244 ) )
Upload routine started for file upload by : photo
/home/mysite/public_html/mysite.com/components/com_chronocontact/uploads/myform_test/20090512072323_032209_006_sm.JPG has been uploaded OK
Form passed the plugins step (if enabled) OK
An email has been SENT successfully from (Admin)admin@mysite.com to [email]myemail@yahoo.com[/email]
Debug End
Redirect link set, click to test:
http://mysite.com/index.php?option=com_content&view=article&id=47:thank-you-for-applying
Thanks!
I can see "An email has been SENT successfully" there - was there no 'dummy' email on the same page? That should show the body of the email and the list of attachments.
Bob
If the file-name shows up in the dummy email then it's in the attachments array which is being sent to the Joomla mailer. I have no real idea what's happening to it after that. Is there anything unusual about the attachment file names?
Bob
In any case, I apolgize Bob for any time you spent trying to figure this out. Next time I'll do several tests on my own before posting a problem.
Once again, thank you for this excellent component!
I'm getting this debug info:
============================================
E-mail message
From: will [will@medotcom.com]
To: [email]me@gmail.com[/email]
CC:
BCC:
Subject: Contact from backpackersbuddy.com.au
Contact Us
Your Name
will
Your Email
[email]will@medotcom.com[/email]
Message
weeeeeeeeeeee
20090514103437_test.txt
Submitted by 115.128.16.201
Files:
Thanks for your email! We will get back to you soon.
1. Form passed first SPAM check OK
2. Form passed the submissions limit (if enabled) OK
3. Form passed the Image verification (if enabled) OK
4. Form passed the server side validation (if enabled) OK
5. $_POST Array: Array ( [name] => will [email] => [email]will@medotcom.com[/email] [message] => weeeeeeeeeeee [cf2d0093242a6dc1deb7d66e7a0fed6d] => 1 )
6. $_FILES Array: Array ( [file_20] => Array ( [name] => test.txt [type] => text/plain [tmp_name] => /tmp/phpLi9uL8 [error] => 0 [size] => 7 ) )
7. /home/supret/public_html/components/com_chronocontact/uploads/contactus/20090514103437_test.txt has been uploaded OK
8. Form passed the plugins step (if enabled) OK
9. An email has been SENT successfully from (will)will@medotcom.com to [email]me@gmail.com[/email]
10. Debug End
====================================================
The attachment is uploaded to the folder on the site, and in my template i have {file_20} but that just adds the name.
I changed the line of code in the chronoformsupload.php file. The form is enabled, no attachments.
Any help gratefully recieved as i'm now stuck.
Thanks,
Will
I suspect that you don't have 'Attatch Files' enabled on the Email setup Properties box.
Bob
Could you list all the possible roadblocks to having attachments to an email?
In setup emails tab:
enabled: Yes
enable attachments: yes
Form tag attachment: set to enctype="multipart/form-data"
Although it does it for you, so that appears twice in the actual html, could that cause issues?
Full upload Path: needs to be set and writeable. (i'm seeing the files appearing into this folder)
The input field name and id should match up (does this really matter?)
like this:
<div class="form_item">
<div class="form_element cf_fileupload">
<label class="cf_label">Attach File</label>
<input class="cf_fileinput cf_inputbox" title="" size="20" id="file_20" name="file_20" type="file" />
</div>
<div class="clear">Â </div>
</div>
you may need to set line 106 of chronoformuploads.php from
$attachments[$allowed_s2[0]] = JPATH_COMPONENT.DS.'uploads'.DS.$MyForm->formrow->name.DS.$filename;
to
$posted[$allowed_s2[0]] = $filename;
if the upload path is non-standard
at this point im stuck, im getting this in the debug:
$_FILES Array: Array ( [file_20] => Array ( [name] => test.txt [type] => text/plain [tmp_name] => /tmp/phpYwzGqd [error] => 0 [size] => 7 ) )
but no file attachment. What do i do? whats the debug proccedure?
I can't understand the second part of your message here:
The input field name and id should match up (does this really matter?)
like this:
<div class="form_item">
<div class="form_element cf_fileupload">
<label class="cf_label">Attach File</label>
<input class="cf_fileinput cf_inputbox" title="" size="20" id="file_20" name="file_20" type="file" />
</div>
<div class="clear">Â </div>
</div>
you may need to set line 106 of chronoformuploads.php from
$attachments[$allowed_s2[0]] = JPATH_COMPONENT.DS.'uploads'.DS.$MyForm->formrow->name.DS.$filename;
to
$posted[$allowed_s2[0]] = $filename;
if the upload path is non-standard
at this point im stuck, im getting this in the debug:
$_FILES Array: Array ( [file_20] => Array ( [name] => test.txt [type] => text/plain [tmp_name] => /tmp/phpYwzGqd [error] => 0 [size] => 7 ) )
but no file attachment. What do i do? whats the debug proccedure?
and which Chronoforms do you have installed ? RC5 should not need any hacks!
Regards
Max
I think that this change will probably break the attachments
you may need to set line 106 of chronoformuploads.php from
$attachments[$allowed_s2[0]] = JPATH_COMPONENT.DS.'uploads'.DS.$MyForm->formrow->name.DS.$filename;
to
$posted[$allowed_s2[0]] = $filename;
There has to be a path in there so that the file location is identified.
Bob
CHRONOFORMS version 3.1
in chornocontact.php, not sure which RC number it is.
It should be exactly as it was in the original file unless you have made other hacks to change the upload folder in which case it should have a full path to that folder.
You can check the version in your Site Admin Extensions Manager.
Basically file uploading just works - if you have a problem then there are a few things that could be wrong mostly depending on server settings and folder permissions. I think you've listed most of them here except for checking the settings on the File Upload tab.
[sendfb][/sendfb]
Bob
adding a little debug code of my own, i see that
if ( $fileok ) {
$uploadpath = $MyForm->formparams->uploadpath ? $MyForm->formparams->uploadpath : JPATH_COMPONENT.DS.'uploads'.DS.$MyForm->formrow->name.DS;
$uploadedfile = JFile::upload($original_name, $uploadpath.$filename);//handle_uploaded_files($original_name, $filename);
$posted[$allowed_s2[0]] = $filename;
JRequest::setVar($allowed_s2[0], $filename);
if ( $uploadedfile ) {
$attachments[$allowed_s2[0]] = JPATH_COMPONENT.DS.'uploads'.DS.$MyForm->formrow->name.DS.$filename;
$MyForm->addDebugMsg($uploadpath.$filename.' has been uploaded OK');
}else{
$MyForm->addDebugMsg($uploadpath.$filename.' has NOT been uploaded!!');
}
}
}
}
print_r($attachments);
$this->attachments = $attachments;
(so just the print_r statement added)
gives me
Array ( [file_20] => /home/supret/public_html/components/com_chronocontact/uploads/contactus/20090515183512_test.txt )
E-mail message
above the debug info. so the file seems to be there and thats the path thats noted as writeable in the fileuploads tab.
my file uploads tab settings are
Enable uploads: yes
fielddd names etc: file_20:jpg|doc|pdf|zip|txt{2000-0}
path: /home/supret/public_html/components/com_chronocontact/uploads/contactus/ (which is same as default, i can't remember if i put it in the box or chronoforms did it for me.)
In the Email Setup please set Enable Attachments to NO, then click Apply.
Then set Enable Attachments to Yes, click Apply again and re-save the form.
Then all should be well.
It seems that the Properties box setting isn't always the same as the saved version that ChronoForms checks- perhaps something about default values being mismatched.
Bob
I think I found what the problem was, at least in my case. Not sure if this helps Will or not.
I created a new form with a file upload button, sent a test and got the data and the attachment as expected. I decided to use the Form Wizard to make one minor change to the form (adding a text field at the top). But when I sent a test of this modified form there was no file attached to the email. I checked my "email attachment" setting and it was no longer set to "yes"... actually, neither "yes" or "no" was selected, just the blank area over yes showed up. I checked "yes", saved the form and resent a test and the uploaded file came through.
So it appears that using the Form Wizard to edit a form may change or delete existing settings elsewhere in the form.
Everything seems OK now. 🙂
Thank you for reporting back the solution, this is the 2nd time its reported, I try it here and this doesn't happen, which Chronoforms version do you have ? are you sure you have your browser cache clean when you did an upgrade (if you did) ?
Regards,
Max
Basic file upload is working (there's an entry in the $_FILES array).
It looks as though the ChronoForms processing is working OK (there's a success message).
Is the file actually in the uploads/ApplyNow folder?
The email attachment isn't working (there's no file-name after 'files:').
Please double check that attachments are enabled in the Email Properties.
Bob