Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Attaching binary files

Status
Not open for further replies.

columb

IS-IT--Management
Feb 5, 2004
1,231
EU
I have a perl script which runs as expected on IBM AIX 5.1 ML7 but fails under RedHad Linux 2.4.21-27.ELsmp.
The relevant part of the code is to do with attaching binary files. I open a pipe to sendmail and then the relevant part of the code goes
Code:
    print OFH "--$boundary\n";
    print OFH "Content-type: Application/Octet-stream; name=$shortname; type=binary\n";
    print OFH "Content-Disposition: attachment; filename=$shortname\n";
    print OFH "Content-Transfer-Encoding: X-UUencode\n\n";
    print OFH `uuencode $file $file`;
If the file is sent from an AIX server all is well, from the Linux server the file arrives with the 'Content-Disposition' and 'Content-Transfer-Encoding' lines prepended and the rest of the file still uuencoded.

If I'm posting in the wrong forum forgive me. I couldn't quite decide whether this belonged in sendmail or linux.

Columb Healy
 
Thanks for your help. I compared the example you gave with my output and it turned out that the file name should be in quotes in, for example,
Code:
print OFH "Content-Disposition: attachment; filename=$shortname\n";
should be
Code:
print OFH "Content-Disposition: attachment; filename=\"$shortname\"\n";

Columb Healy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top