SOLVED .. KInda .. File Uploads but not attached to email

froggie81 20 Apr, 2009
Hi;

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

Any Ideas or Help would be greatly appreciated🙂

Thanks!
Frank
GreyHead 20 Apr, 2009
Hi 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
GreyHead 20 Apr, 2009
Hi Frank,

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
froggie81 20 Apr, 2009
Hi;

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
froggie81 20 Apr, 2009
The problem was that even though in the email setup was set for attachments, it actually wasnt.
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.
GreyHead 20 Apr, 2009
Hi Frank,

Thanks for the fix

Bob
msm 11 May, 2009
I seem to be having the same problem as Frank, but I tried the "enable on/off" fix and it wouldn't work for me. I don't know how to check the MySQL settings so I can't say what those are.

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.
GreyHead 11 May, 2009
Hi msm,

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
msm 12 May, 2009
Here it is (I changed my website and email info below since I'm not ready to post it to the public yet):

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!
GreyHead 12 May, 2009
Hi msm,

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
msm 13 May, 2009
Yes, the dummy email showed up also... I just didn't include it in my above post. The emails are also being successfuly sent to me, but with no attachment. The file name is mentioned in both the dummy email and real one.
GreyHead 13 May, 2009
Hi Msm,

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
msm 14 May, 2009
I just created another form from scratch and this time the file was sent fine. I must have missed something when I created the other test form, although I'm still not sure what happened to my first form that was working fine and then stopped sending attachments.

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!
asecondwill 14 May, 2009
ok, im having this problem too.

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
GreyHead 14 May, 2009
Hi asecondwill,

I suspect that you don't have 'Attatch Files' enabled on the Email setup Properties box.

Bob
asecondwill 15 May, 2009
Hi, Unfortunatly I do have that ticked.

Could you list all the possible roadblocks to having attachments to an email?
asecondwill 15 May, 2009
Or, i could do it myself:

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?
Max_admin 15 May, 2009
Hi asecondwill,

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
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
GreyHead 15 May, 2009
Hi Will,

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
asecondwill 15 May, 2009
What should that line be then? Niether work. I get an email with no attachments. I downloaded chronoforms about 2 weeks ago, it says
CHRONOFORMS version 3.1

in chornocontact.php, not sure which RC number it is.
GreyHead 15 May, 2009
Hi asecondwill,

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
asecondwill 15 May, 2009
Nope, I havn't made any changes to the file. Just that one that was asked for on these forums somewhere, but i put that back to the original file.

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.)
GreyHead 15 May, 2009
Hi asecondwill,

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
msm 17 May, 2009
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. 🙂
Max_admin 18 May, 2009
Hi msm,

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
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
lies 02 Jun, 2009
Same thing happened to me. Version RC5. I made a form, and worked great. Through the wizard I changed the name of the "From to". Then my attachments would not show up. Without the wizard I edited the setup email. I put all attachment fields to no, than applied, then set it back to Yes. Now the attachments show up properly.
GreyHead 29 Jul, 2009
Hi pdw207,

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
This topic is locked and no more replies can be posted.