View Full Version : Form Attachments
08-Jul-2004, 01:39 PM
Hope you can help, ive been looking for a script that will allow me to send attachments from forms for ages so thanks for that.
Im currently trying to get it working, here is what I have html wise:
<form action="http://www.xxxxxxxxxxx/cgi-bin/formmail.php" method="post" enctype="multipart/form-data">
<input type="file" name="file" size="40" class="box" id="file">
But im having problems sending the form, comes back with the message "internal server error", ive probably missed something out on the formmail.php file but im not sure what, the only thing ive changed is the TARGET_EMAIL section to reflect the domain its being sent to. The current host supports PHP so that should be ok.
Hope that helps.
08-Jul-2004, 01:50 PM
Make sure you set DEF_ALERT (near line 974) to your email address too...That way you'll get messages from FormMail that tell you why things aren't working (usually).
However, to support file uploads, you need to also set another configuration value.
Around line 1247, you'll see:
define("FILEUPLOADS",false); // set to true to allow file attachments
Change it to this:
define("FILEUPLOADS",true); // set to true to allow file attachments
If that doesn't work, remove your "file" field from the form and get it working with just some normal text fields first.
Once it's working (ie. you're receiving info from FormMail in your email) with some simple fields, you can add your file field again and you should be fine.
08-Jul-2004, 02:22 PM
Still having issues just trying to send a basic form, here is the link to the php.
Sorry to be a pain, still getting internal server error messages.
08-Jul-2004, 02:33 PM
Sorry wrong link:
But when the php file is not in the cg-bin folder i get a different error message:
Method Not Allowed
The requested method POST is not allowed for the URL /formmail.php
08-Jul-2004, 09:27 PM
In your top directory, FormMail doesn't run at all - it just downloads the source code.
So, it definitely needs to be in your cgi-bin directory on your server.
I've had a look at the one in http://www.computerworld-it.com/formmail.php
and there's no problem in the configuration - you've done it right.
You now need to generate the server error again and look at your Apache log files to see what's actually gone wrong.
Only one thought springs to mind: the file formmail.php needs to be readable by Apache: rw-r--r-- should be fine. You can also try: rwxr-xr-x
09-Jul-2004, 07:46 AM
Just had a quick look through the error logs and this one seems to pop up quite frequently.
[error] [client 188.8.131.52] Premature end of script headers: /var/www/docs/C/CO/comp/cgi-bin/formmail.php
09-Jul-2004, 08:04 AM
It's starting to sound like your server doesn't handle PHP.
Can you try the test in this post: http://www.tectite.com/vbforums/showthread.php?t=80
Put the script in the cgi-bin directory and see if you can open it with a browser.
09-Jul-2004, 08:56 AM
Doesnt seem to like it when its placed in the cgi-bin, works fine from the root though.
09-Jul-2004, 09:59 PM
That seems inconsistent....the phpinfo script works in the root directory but not in cgi-bin but formmail.php won't work in the root directory and seems to try to work in cgi-bin!?!
Do you have any other PHP scripts that work anywhere on your server?
Powered by vBulletin® Version 4.1.4 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.