Perl Script not handling File uploads in form...

I am currently using the following perl script (http://nms-cgi.sourceforge.net/) to handle a form that I have on my website.  The form has one section where a file (a picture) is uploaded, and I have been told the perl script I am using does not support this.  Here is the form:

<FORM METHOD=POST

ACTION="http://www.thephotofix.completelyfreehosting.com/scgi-bin/FormMail.pl"

ENCTYPE="multipart/form-data">


<input type="hidden" name="subject" value="The Photofix">

<LABEL for="realname">Your name [optional]:</LABEL> <br>
<INPUT TYPE="text" NAME="realname">
<p>

<LABEL for="email">Email address:</LABEL><br>
<INPUT TYPE="text" NAME="email">
<p>

<LABEL for="file">Upload picture:</LABEL><br>
<input type="file" name="file" size="40">
<p>

<LABEL for="services">Services requested on this photo:</LABEL><br>
<textarea rows="10" cols="30" name="services">
Type what you would like to have done to your photo.
</textarea>
<p>


<LABEL for="prints">How are you reaching this page?</LABEL><br>
   <SELECT name="prints" id="prints">
   <OPTION value="other">No response (Answer later via e-mail)</option>
   <OPTION value="4x6">Yes, 1(one) 4X6 photo. [+4 dollars]</option>
   <OPTION value="5x7">Yes, 1(one) 5X7 photo. [+4 dollars]</option>
   <OPTION value="8x6">Yes, 1(one) 8X6. [+4 dollars]</option>
   <OPTION value="yes">Yes, other amount or size, specified in list of

services.</option>
   <OPTION value="no">No, email me the finished product.</option>
   </SELECT>
<p>

<input type="hidden" name="recipient" value="grimtooth@fuse.net">
<input type="submit" value="Submit">

</FORM>

I need to be directed to a new perl script that is secure and will handle all the parts of my form, or shown what to add to my perl script for it to allow file uploads to be sent to me via e-mail.  Thanks
grimtoothAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ahoffmannCommented:
quick&dirty part to read the file upload:

use CGI;
my $q=new CGI;
my $f=$q->param('file');
my $file=$f;
$file=~s/[^a-zA-Z0-9\.\-]//g;
# your code here to sanatize the passed filename
open(F,">$file") &&  while (my $bytesread=read( $f,$buffer, 8192 )) {print F $buffer;} && close F;
grimtoothAuthor Commented:
I had no idea where to put that in the script, but I looked through it and found a section that looked appropriate.  Here is what that part looks like:

# USER CUSTOMISATION SECTION
# --------------------------
# Place any custom code here

use CGI;
my $q=new CGI;
my $f=$q->param('file');
my $file=$f;
$file=~s/[^a-zA-Z0-9\.\-]//g;
# your code here to sanatize the passed filename
open(F,">$file") &&  while (my $bytesread=read( $f,$buffer, 8192 )) {print F $buffer;}

&& close F;


# USER CUSTOMISATION << END >>
# ----------------------------
# (no user serviceable parts beyond here)
}

When I attempt to run the form, I get this error:  "500 Error referred from http://www.thephotofix.completelyfreehosting.com/test2.html"  Definitely from the addition of this code, because I recieved no error messages before.
ahoffmannCommented:
hmm, it's a bit hard to guess the correct code for your script
you need to participate in that way that you try to understand what the code (posted here and in your script does), otherwise any posted code fails (except someone miracly guesses the right code snippet).

What to do now?
 1. first find the proper place in your script where to put the code
 2. check if you need to   "use CGI;"  again
 3. check if all variablenames are unique
 4. check your changes by running the script from command line
 5. post error messages from 4. if ther're any

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
grimtoothAuthor Commented:
I did not realize at first that all the different scripts would require different coding to add file upload support.  I have found a perl script that already has this, and a lot of other features:  http://soupermail.sourceforge.net/  Thanks for all the help, guys!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Scripting Languages

From novice to tech pro — start learning today.