N
Nara Bala
Hi,
I am doing a cgi script through which the client attaches a file on
the local machine and submits a form, upon which the file is uploaded
to an unix-based server and emailed using sendmail as an attachment.
I am able to send ordinary text files successfully. But when I try
doing it for word documents. The file is attached and sent. But when I
recieve it, the file is slighlty largerthan the original file and it
doesnt open in Word. The word throws an error saying "The document
name or path is not valid....". I tried saving the file to local
machine and then opening still i have the same problem.
Pls. let me know what mistake I am making.
Look at this code -
#!/usr/bin/perl
use CGI;
use CGI qwstandard);
require 'CGI_LIB.pl';
my $sendmail = "/usr/lib/sendmail -t";
my $filename = "/srcm/smsf/temp/uploadedFile.txt";
&Parse_Multi;
binmode($CGI);
open(SENDMAIL, "|$sendmail") or die "Cannot open $sendmail: $!";
print SENDMAIL <<"EOF";
Content-Transfer-Encoding: 7bit
Content-Type: multipart/mixed; boundary="=_3D647253.85E4AEC4"
MIME-Version: 1.0
Date: Thu, 21 Mar 2002 19:32:35 UT
From: nara\@hotmail.com
To: narayananb\@ami.com
Subject: Testing File Attachments - quoted printable
This is a MIME message. If you are reading this text, you may want to
consider changing to a mail
reader or gateway that understands how to properly handle MIME
multipart messages.
--=_3D647253.85E4AEC4
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
Test from Shane
Hello World
--=_3D647253.85E4AEC4
Content-Description: "$filename"
Content-Type: $CGI{'UploadedFile'}->{'Content-Type'};
charset=iso-8859-1
Content-Disposition: attachment; filename="file_name.doc"
$CGI{'UploadedFile'}->{'Contents'}
--=_3D647253.85E4AEC4--
EOF
close(SENDMAIL) or warn "sendmail did not close nicely";
$url = "/others/feedback-thanks.html";
print "Location: $url\n\n";
# end of code
exit;
thanks,
Nara
I am doing a cgi script through which the client attaches a file on
the local machine and submits a form, upon which the file is uploaded
to an unix-based server and emailed using sendmail as an attachment.
I am able to send ordinary text files successfully. But when I try
doing it for word documents. The file is attached and sent. But when I
recieve it, the file is slighlty largerthan the original file and it
doesnt open in Word. The word throws an error saying "The document
name or path is not valid....". I tried saving the file to local
machine and then opening still i have the same problem.
Pls. let me know what mistake I am making.
Look at this code -
#!/usr/bin/perl
use CGI;
use CGI qwstandard);
require 'CGI_LIB.pl';
my $sendmail = "/usr/lib/sendmail -t";
my $filename = "/srcm/smsf/temp/uploadedFile.txt";
&Parse_Multi;
binmode($CGI);
open(SENDMAIL, "|$sendmail") or die "Cannot open $sendmail: $!";
print SENDMAIL <<"EOF";
Content-Transfer-Encoding: 7bit
Content-Type: multipart/mixed; boundary="=_3D647253.85E4AEC4"
MIME-Version: 1.0
Date: Thu, 21 Mar 2002 19:32:35 UT
From: nara\@hotmail.com
To: narayananb\@ami.com
Subject: Testing File Attachments - quoted printable
This is a MIME message. If you are reading this text, you may want to
consider changing to a mail
reader or gateway that understands how to properly handle MIME
multipart messages.
--=_3D647253.85E4AEC4
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
Test from Shane
Hello World
--=_3D647253.85E4AEC4
Content-Description: "$filename"
Content-Type: $CGI{'UploadedFile'}->{'Content-Type'};
charset=iso-8859-1
Content-Disposition: attachment; filename="file_name.doc"
$CGI{'UploadedFile'}->{'Contents'}
--=_3D647253.85E4AEC4--
EOF
close(SENDMAIL) or warn "sendmail did not close nicely";
$url = "/others/feedback-thanks.html";
print "Location: $url\n\n";
# end of code
exit;
thanks,
Nara