Wrapping MIME around an appledouble file


Subject: Wrapping MIME around an appledouble file
From: Chris Garrigues (cwg-dated-e7ea9493218076d8@deepeddy.com)
Date: Thu Feb 15 2001 - 12:07:25 EST


I need to grab a file saved on a server using netatalk from a perl CGI and
transmit it to the user.

So far, all my attempts do is to crash netscape with an error of type 3. This
makes it kinda hard to debug.

Has anybody done this? Is there anything special I have to do to the data?

Maybe I just have a dumb typo or thinko. here's my code fragment:

            open(FILE, "<$filename")
                or die "Couldn't read $filename: $!";
            open(RESOURCEFILE, "<$resourcefilename")
                or die "Couldn't read $resourcefilename: $!";
            print "Content-Type: multipart/appledouble; boundary=mac-part\n";
            print "\n";
            print "--mac-part\n";
            print "Content-Type: application/applefile; name=\"$filepart\"\n";
            print "Content-Transfer-Encoding: 8bit\n";
            print "\n";
            while (<RESOURCEFILE>) {
                print $_;
            }
            close(RESOURCEFILE);
            print "\n";
            print "--mac-part\n";
            print "Content-Type: application/octet-stream\n";
            print "Content-Transfer-Encoding: 8bit\n";
            print "\n";
            while (<FILE>) {
                print $_;
            }
            close(FILE);
            print "\n";
            print "--mac-part--\n";

Any help would be appreciated.

Chris

-- 
Chris Garrigues                 http://www.DeepEddy.Com/~cwg/
virCIO                          http://www.virCIO.Com
4314 Avenue C                   
Austin, TX  78751-3709		+1 512 374 0500

My email address is an experiment in SPAM elimination. For an explanation of what we're doing, see http://www.DeepEddy.Com/tms.html

Nobody ever got fired for buying Microsoft, but they could get fired for relying on Microsoft.




This archive was generated by hypermail 2b28 : Sun Oct 14 2001 - 03:04:32 EDT