Hi there!!

My code below works, well it works till I got the file attached that comes in empty. I just can't figure it out what is causing it to be empty. Can anyone look at this and please let me know what I am not seeing it? I am using the right stuff on the html form

...METHOD="post" ENCTYPE="multipart/form-data"

, but it's got to be something else that I can't see, please help.....
Here is the code
use CGI qw(:standard); use CGI::Carp qw(fatalsToBrowser); use Mail::Sender; $q = new CGI; # uploading the file... my $position = &filter($q->param('position')); my $name = &filter($q->param('name')); my $email = &filter($q->param('email')); my $filename = &filter($q->param('filename')); print header(); if ($filename ne ""){ $tmp_file = $q->tmpFileName($filename); }else{$filename= "No Attachment";} ref ($sender = new Mail::Sender({from =>$email,smtp=> 'mytest.temp.hos +ting.com'})) or die "$Mail::Sender::Error\n"; (ref ($sender->MailFile( {to =>'thetester@test.com', cc=>'mytest@test.com',subject =>$positio +n, msg => "Hi.\nI'm sending you the pictures you wanted.", file => $filename })) and print "Mail sent OK." ) or die "$Mail::Sender::Error\n"; sub filter { $_[0]=~s/\'/\\\'/g; $_[0]=~s/<//g; $_[0]=~s/>//g; $_[0]=~s/;//g; $_[0]=~s/\(//g; $_[0]=~s/\)//g; $_[0]=~s/\"//g; $_[0]=~s/\'//g; $_[0]=~s/\?//g; $_[0]=~s/script//g; $_[0]=~s/\///g; $_[0]=~s/>//g; $_[0]=~s/@/\@/g; #$_[0]=~s/\%2F//g; return $_[0]; } __END__

Thanks!

Edit by BazB: add readmore tags


In reply to Email attachment help! by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.