Elliott has asked for the wisdom of the Perl Monks concerning the following question:

I am trying to deliver a zipped file as follows:
print "Content-type: application/zip\n\n"; open(Z,"<zipfile.zip"); @zip=<Z>; close Z; foreach$zip(@zip) { print $zip; }
With other servers whem I've done something similar, I've been able to name the Perl script file.zip - and that ends up as the name of the downloaded file. With this server, it refuses to allow me to send it a post if I give it a .zip extension. If I give it a .pl extension, it delivers the file but named so as to confuse poor Windoze.

Help! I'm sure I'm missing something really obvious.

Replies are listed 'Best First'.
Re: Delivering a zipped file
by dws (Chancellor) on Jun 20, 2003 at 00:13 UTC
    I am trying to deliver a zipped file as follows: ...

    To clue the browser in on what filename you'd like the file saved as, you need to provide a Content-Disposition header, and you might need to use a content-neutral Content-Type. This node provides a working example.

      Thank you! it works!

      (I have horrible feeling I actually knew that - but y'know what it's like programming at 1am...)