On the other hand if I take out that code, I then get the notification email but then the file no longer uploads.
This seems to be a bit of a catch 22. Any suggestions?
The two shouldn't be linked at all, the code that deals with each is pretty much completely separate.
Please take a Form Backup in the CF Form Manager and post it here or email it to me at the address in my sig and I'll take a look.
Bob
You need to have a value in the Minimum size field on the File uploads tab - please try 1 and see if that makes the difference.
Bob
It's working OK for me here. I've restored your file; put 1 in the min field; changed the email address to my own (you'll get the first couple though); temporarily removed the redirect URL; and turned debug on. Otherwise I'm using your code as is.
Bob
PS I notice that there are two 'name =' entries in the file input tag, probably isn't causing this problem but might give ChronoForms indigestion.
My server Apache on another machine on the network here so it's semi-remote. We've seen plenty of examples where on-line form file upload works so I guess you've hit some configuration issue with Rackspace. Good luck with getting it resolved.
Bob
"When you use enctype="multipart/form-data" you cannot access the form parameters. You have to construct a query string and append it to the action before submitting (a onclick event to the submit or button0."
Does that make any sense to you?
Did you ever figure this out? I have the same problem with my forms.
No I am going to have our PHP guy look at it today or tomorrow
I had a Google around this morning and found various things about setting the max_file_size in different places and ways and some about losing the $_POST entries but nothing that was very clear I'm afraid.
Bob
marc.info
usenet-forums
gidforums
All these people are having the same problem i am and one even says if worked fine on local server but not remote.
I searched Google for this: enctype= multipart/form-data php
Also -- Our Joomla is running on PHP 5.2.5
Edited to add url tags<br><br>Post edited by: GreyHead, at: 2008/01/23 18:03
Like you I found plenty of references to the problem and precious few clear explanations or fixes.
It seems to me that there are several different problems intertwined here:[list]
Bob
Yup, it's confirmed. A newly designed form and new table. After adding the enctype='multipart/form-data' to the General Tab, it no longer even gives me a name of the file, nor does it even send the eMail message.
so I feel better it's not just me.Our PHP coder is working on this now, he knows Joomla really well also so I will post back when I learn something.
Edited to add url tag<br><br>Post edited by: GreyHead, at: 2008/01/23 18:57
This is dniezby, I was looking at his site last night and I don't think he has the same problem as you as it seems (to me at least) that the file and data are both received but the problem is with the email not being sent by Joomla. It may turn out that these are different symptoms of the same problem but I don't know yet.
Bob
OH MAN...I just remembered, I wrote a script for a form a little while ago that uploaded a file to the server and sent an eMail with a link to a recipient. I wonder if it will help to read through it?
Let me see if I can find it.
This script, was for an individual form submission where I knew the $_POST variables. But it should help...I hope.
What it does is upload the file to s specified location and attach it to an email message.
I can see that there would need to be a change in a way that the $_POST variables are collected...Perhaps an array? Though I suck at those.
I remember, I wrote this for a flash form. Every variable that ends in var would be the field name="uploadedvar" in a regular form.
<?php
$fileatt = "files/". $_POST["uploadfilevar"]; // Path to the file
$fileatt_type = "application/octet-stream"; // File Type
$fileatt_name = $_POST["uploadfilevar"];
$first = $_POST["firstvar"];
$last = $_POST["lastvar"];
$addy = $_POST["addyvar"];
$city = $_POST["cityvar"];
$state = $_POST["statevar"];
$zip = $_POST["zipvar"];
$dob = $_POST["dobvar"];
$phone = $_POST["phonevar"];
$wga = $_POST["wgavar"];
$usc = $_POST["uscvar"];
$subType = $_POST["subTypevar"];
$stitle = $_POST["stitlevar"];
$presynopsis = $_POST["synopsisvar"];
$synopsis = stripslashes($presynopsis);
$from = $_POST["e_addyvar"];
$email_from = $from; // Who the email is from
$email_subject = $_POST["subjectvar"];
$email_txt = <<<EOF
<html>
<body bgcolor="#ffffff" text="#000000">
<table align="center" bgcolor="#9999ff" border="1" cellpadding="2"
cellspacing="2" width="100%">
<tbody>
<tr align="center">
<td colspan="2" bgcolor="#9999ff" valign="top"><b>NEW SCREENPLAY
SUBMISSION<br>
</b><small>$date</small><b><br>
</b> </td>
</tr>
<tr align="right">
<td colspan="2" valign="top"><b><font color="#ff0000">$subType</font><br>
</b></td>
</tr>
<tr>
<td valign="top">Name<br>
</td>
<td valign="top">$last , $first ($dob)<br>
</td>
</tr>
<tr>
<td valign="top">Address<br>
</td>
<td valign="top">$addy<br>
</td>
</tr>
<tr>
<td valign="top">City,State,Zip<br>
</td>
<td valign="top">$city, $state . $zip<br>
</td>
</tr>
<tr>
<td valign="top">Phone<br>
</td>
<td valign="top">$phone<br>
</td>
</tr>
<tr>
<td valign="top">eMail<br>
</td>
<td valign="top">$email_from<br>
</td>
</tr>
<tr>
<td valign="top">WGA Registration No<br>
</td>
<td valign="top">$wga<br>
</td>
</tr>
<tr>
<td valign="top">US Copyright No<br>
</td>
<td valign="top">$usc<br>
</td>
</tr>
<tr>
<td valign="top">Screenplay Title<br>
</td>
<td valign="top">$stitle<br>
</td>
</tr>
<tr>
<td colspan="2" valign="top">Synopsis<br>
</td>
</tr>
<tr>
<td colspan="2" valign="top">$synopsis<br>
</td>
</tr>
</tbody>
</table>
</body>
</html>
EOF;
// Check for Demo Submission.
switch ($usc){
case "demo":
$email_to = $from;
break;
case "DEMO":
$email_to = $from;
break;
case "Demo":
$email_to = $from;
break;
default:
$email_to = "dniezby@sample.com";
}
$headers = "From: ".$email_from;
$file = fopen($fileatt,'rb');
$data = fread($file,filesize($fileatt));
fclose($file);
$semi_rand = md5(time());
$mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";
$headers .= "\nMIME-Version: 1.0\n" .
"Content-Type: multipart/mixed;\n" .
" boundary=\"{$mime_boundary}\"";
$email_message .= $email_txt . "\n\n" .
"--{$mime_boundary}\n" .
"Content-Type:text/html; charset=\"iso-8859-1\"\n" .
"Content-Transfer-Encoding: 7bit\n\n" .
$email_txt . "\n\n";
$data = chunk_split(base64_encode($data));
$email_message .= "--{$mime_boundary}\n" .
"Content-Type: {$fileatt_type};\n" .
" name=\"{$fileatt_name}\"\n" .
"Content-Disposition: attachment;\n" .
" filename=\"{$fileatt_name}\"\n" .
"Content-Transfer-Encoding: base64\n\n" .
$data . "\n\n" .
"--{$mime_boundary}--\n";
$ok = @mail($email_to, $email_subject, $email_message, $headers);
unlink ($fileatt);
?>
<br><br>Post edited by: dniezby, at: 2008/01/24 20:47
Which file processes the forms so I can take a look as well and see if I can't figure out why it's not sending the form.
Check line 91 of chronocontact.html.php
There is no parsing of enctype.
This would explain everything. If you add the enctype, it would cause an error because it's got file attached without enctype and it's not in the form setup. If you don't add the enctype, it would send the mail on php's default settings. No file = nothing but text. Ok to send.
I would edit the code myself and test it but I don't know what variable you're using for enctype nor do I know if it should query the database as you have some entries that do and some that don't.
Here is the line as you have it now. Notice the absence of enctype?
<form
name="<?php echo "ChronoContact_".$rows[0]->name; ?>"
id="<?php echo "ChronoContact_".$rows[0]->name; ?>"
method="<?php echo $paramsvalues->formmethod; ?>"
action="<?php echo $actionurl; ?>"
<?php echo $rows[0]->attformtag; ?>>
Edited to break up long line<br><br>Post edited by: GreyHead, at: 2008/01/28 16:13
I think I found the problem.
Check line 91 of chronocontact.html.php
There is no parsing of enctype.
This would explain everything.
That makes sense, I had our PHP guy write his own function for upload and it works fine so we are using chronoforms to execute our own upload / email notify code but not using chronoforms upload function and it works fine.
I am guessing because there are different versions of chronoforms out there (depending on when you downloaded / updated it in Joomla), thats why it works for some people and not for others.<br><br>Post edited by: brewster, at: 2008/01/28 16:07
I don't think that is the problem, the enctype attribute is added in the $rows[0]->attformtag part of the line.
If it's OK with you and your IT Guy I would be interested in seeing the function he created to see if we can use it to create a workaround for this problem. It's proving tricky yo diagnose because I can't replicate it on my test sites (or the live ones come to that).
Bob
If it's OK with you and your IT Guy I would be interested in seeing the function he created to see if we can use it to create a workaround for this problem. It's proving tricky yo diagnose because I can't replicate it on my test sites (or the live ones come to that).
Bob
Sure I will send you an email with instructions how to login to demo and see the code. It's a work in progress but it is working.
Thanks for this, all received. I'll take a look, probably tomorrow morning.
Bob
(I'm working with Chronoforms 2.5 on Joomla 1.5)
Please turn the DEBUG ON and if it tells "Emails sent" then the email is getting blocked by some thing!
Regards
Max
thanx for the answer.
Debug is on. Has to be something else - but what? :?
Max
The uploaded file is very small (bmp|gif|jpg|png|wmf{200-1}) and I did not included the upload on the email template.
When uploads are enabled and after I submit the form, the incoming mail on my mail(mac) times out and I get an error message or I get nothing.
Same problem when I put enctype="multipart/form-data" in the form tag attachment under the general tab.
How do I enable the uploads but still allow the notification email to come through?
PS Please include every step, I know very little php.
Thanks in advance.
when you have uploads enabled but you don't choose a file to upload before submitting the form, do you get the email ?
Regards
Max
The short answer - even empty, the upload field stops the email.
I had the form working without the upload field.
Using the Wizard Edit, I put the File Upload label&field back on the form. Filled in the required fields and left the File Upload field blank. Submitted the form with debug on.
The confirmation page had the following debug message:
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: ...(looked fine)
6. $_FILES Array: Array ( [signature] => Array ( [name] => [type] => [tmp_name] => [error] => 4 [size] => 0 ) )
7. Form passed the plugins step (if enabled) OK
Noted the [error] in 6. In the file uploads tab I changed the sizes from {200-1} to {200-0} and tried again but I got the same debug message.
Clicked submit on the confirmation page. The thank-you page came up with the following debug message
1. An email has been SENT successfully ...
2. Debug End
But alas no email.
Seems to me that you have some linked errors here.
The file upload and the email aren't linked in ChronoForms so what I think is happening is that there is probably a PHP error that crashes the PHP execution at the file upload stage so it never gets as far as sending the email.
The [error] => 4 in the $_FILES array is a Server error, not a ChronoForms error - I think it means 'No File Uploaded' - that would seem to be true. To fix this you probably do need to add enctype="multipart/form-data" on the General Tab.
There's still an error after this and my guess it that there may be some mismatch between the field_names, or a permissions problem with the uploads folder.
[sendfb][/sendfb]
Bob
I added enctype="multipart/form-data" as suggested but it didn't change the outcome.
Trying to locate the source of the problem, this morning with the form wizard, I made a simple form with 3 text boxes, the file upload, a captcha and a submit button.
Saved it.
Made a very simple confirmation page and a thank-you page that used only two fields and very basic html.
On the first try, the image uploaded and the email was received with the image showing on the email. Wonderful! but it only happened once. When I repeated the test, the image uploaded and the email was sent but I only got the name of the image in the email. Better than nothing. The image is only an 8kb gif.
Added text boxes to the form but kept the email template simple. The email kept getting through and the file continued to upload.
So then I deleted the simple email message I had made at the beginning and kept the email template blank. It defaulted to include all the fields on the form and the email stopped working at 7 fields on the email. The email I received with 7 fields is 2.2kb so size isn't the problem.
Every try, successful or not, got the same debug message:
6. $_FILES Array: Array ( [signature] => Array ( [name] => flag.gif [type] => image/gif [tmp_name] => /tmp/phplNQPWg [error] => 0 [size] => 6120 ) )
The database tables for any of these forms seem to be fine.
Should I accept the inevitable and keep the emails tiny or is there a simple fix?
Attached is a copy of the form backup.
Thanks for taking a look at this. You guys must be at this 24/7!
The bad news is that it's working perfectly here. I've turned off the Anti-Spam for testing and changed the upload path but otherwise the form is unchanged.
I suspect that the upload folder on your server may not be writeable by the Joomla user. Please try setting Error Reportign to Maximum in the Site Global Configuration and see if you they get any helpful error messages.
Bob
Thanks for trying it on your system.
I set error reporting to max. I didn't recognize any errors or warnings when I turned the Debug System on.
Just to clarify - Uploading is fine. The files upload nicely to the default folder or any folder I specify in the Full File Uploads Path under the Uploads Tab. It is the email/upload combo that seems to limit the size or complexity of the email I can send.
I haven't checked out the solution at http://www.chronoengine.com/index.php?option=com_fireboard&Itemid=37&func=view&catid=5&id=5260#5260 Max suggested to dniezby in February/08 because at first glance that seems to deal with an uploads problem.
For now I'm okay with little notification emails and maybe that's okay for others browsing this forum for a solution to the same problem.
I'll get back to trying other things when I need to include the uploaded images in the email or send an email with more than 7 fields. Maybe by then I or someone else will have figured it all out.
Cheers for now.
Queen Tut