Perl

Moderators: Jonathan
Number of threads: 1259
Number of posts: 3644

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Attaching a file to email Posted by zeno on 16 Apr 2002 at 3:19 AM
Please help. I am trying to attach a file to a genererated email.

Here is the relevant HTML form code: <FORM ... enctype="multipart/form-data"> and <INPUT ... type=File" name="WordDoc">. And I have pasted the relevant CGI code below.

The problems is that the email works fine until the user actually attempts to attach a file. In other words, if the HTML form is filled-out without attaching a file ($WordDoc) then the email is generated and all is well. But if the user, in addition, attaches a file then the CGI script fails.

the CGI code:

open MAIL, "$mailprogram";

print MAIL "To: $recip\n";
print MAIL "From: $from_addr\n";
print MAIL "Subject: $subject\n";

print MAIL "Content-Type: multipart/mixed; boundary=boundarystring\n";

print MAIL "--boundarystring\n";
print MAIL "Content-type: text/html\n";
print MAIL $message;

print MAIL "--boundarystring\n";
print MAIL "Content-Type: application/msword\n";
print MAIL "Content-Transfer-Encoding: base64\n";
print MAIL "Content-Disposition: attachment; filename='TheWordDoc.Doc'";
print MAIL $FORM{$WordDoc};

print MAIL "--boundarystring--";

close MAIL;

Thank you. Peter.


Report
Re: Without using LITE Posted by zeno on 16 Apr 2002 at 5:06 AM
In addition: Can I do this without using any additional libraries, like LITE?



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.