Chady has asked for the wisdom of the Perl Monks concerning the following question:
I then wanted to restrict downloads through this script, so that people cannot know the real location of the file and download it directly. so what I need is: have a file called foo_application1_bar.zip (or other) and then when I spit the contents to the browser I want to specify the filename to save with ex: Application1.zip
I wrote a little script to test with :
#!/usr/bin/perl -w open (ZIP, "test.zip"); binmode(ZIP); @all = <ZIP>; close(ZIP); print "Content-type: application/zip\n\n"; foreach (@all) { print; }
this ran, I have a "save file to disk" message with the default filename fetch.pl and having the .pl extension associated with a prog on my pc, I couldn't change the extension. but when I renamed the file to fetch.zip it opened and was the file requested.
How can I specify the filename to save? I think it's a header but I can't find it.
Note: I know that the script is badly programmed and I should die on open failure and stuff, but as I said I was only testing.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(jeffa) Re: Specifying filename for download
by jeffa (Bishop) on Mar 02, 2001 at 00:39 UTC | |
|
Re: Specifying filename for download
by mr.nick (Chaplain) on Mar 02, 2001 at 02:47 UTC | |
by Chady (Priest) on Mar 02, 2001 at 12:34 UTC | |
|
Re: Specifying filename for download
by merlyn (Sage) on Mar 02, 2001 at 00:37 UTC | |
|
Re: Specifying filename for download
by sierrathedog04 (Hermit) on Mar 02, 2001 at 03:19 UTC |