Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: CGI.pm woes with multipart attachments

by sedhed (Scribe)
on Jul 25, 2002 at 21:53 UTC ( #185362=note: print w/replies, xml ) Need Help??


in reply to CGI.pm woes with multipart attachments

Perhaps a piece of the puzzle: Your magic line Content-Disposition: attachment\; filename=$file is what suggests the filename for the browser. CGI's multipart_start() function does not print this. However, you should be able to pass it yourself:

print multipart_start( -TYPE=>'application/octet-stream', '-Content-Disposition'=>"attachment\; filename=test.tgz", # Have t +o quote the directive here );

An aside: I don't know how, offhand, to determine the current filename using merlyn's code, other than a kludge like $filename = $ARGV[$count++]; since $_ is the contents of each file, not the file's name.

Update: Sorry if this is obvious: Don't forget to try running it from a command-line to debug. That will let you see the exact headers and file contents the script is printing.

Cheers!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://185362]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (2)
As of 2022-05-24 22:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (84 votes). Check out past polls.

    Notices?