[linux-help] Re: Perl/CGI Question
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Google rocks. I haven't bothered to actually figure out the code you will
need, but I found that you can use a "content-disposition" header, with a
"filename" parameter to suggest a file name to the browser. If you use
cgi.pm, it may already support this functionality. If not you may want to
read the RFC 2183 (http://www.cis.ohio-state.edu/htbin/rfc/rfc2183.html) to
figure out how to format the header.
Jeremy
----- Original Message -----
From: "Jeremy King" <jmking@xxxxxxxxxxxxxx>
To: <linux-help@xxxxxxxxx>
Sent: Tuesday, December 12, 2000 7:30 PM
Subject: [linux-help] Re: Perl/CGI Question
>
> You aren't supposed to ask really hard questions.
>
> I don't know how this is done. I suppose that one *very* klugy solution
> might be to name your cgi script with the name that you want the
downloaded
> file to have. This will probably not work, since the file type you are
> trying to download is probably not a permitted file type in your cgi-bin
> directory. A better solution might be to find someone who knows what they
> are talking about... Let me know if you find a solution--I would really
> like to hear it. In fact, I'll probably need to do this very thing at
some
> point in the future. Perhaps there is some way to set the file name in
the
> http header? I suppose I should run some queries on google...
>
> Jeremy
>
> ----- Original Message -----
> From: "Curtis Hawthorne" <cghawthorne@xxxxxxxxx>
> To: <linux-help@xxxxxxxxx>
> Sent: Tuesday, December 12, 2000 6:41 PM
> Subject: [linux-help] Re: Perl/CGI Question
>
>
> >
> > Ok, that works fine. How do I specify a different
> > file name for it to downloaded as? Using just a
> > header like "Content-type: application/octet-stream"
> > it downloads it, but tries to save it as file.cgi or
> > whatever the program is called.
> >
> > Thanks!
> >
> > Curtis
> > --- Jeremy King <soapboxalpha@xxxxxxxxx> wrote:
> > >
> > > Sure. Most cgi's just begin their output with a
> > > http
> > > header that sets the mime type to text/html. What
> > > you'll want to do is print a http header that sets
> > > the
> > > mime type to whatever the correct file type is:
> > > text/plain, application/excel, image/gif, etc. For
> > > more authoritative info (the above mime types should
> > > be right, but I've been known to be wrong. Once or
> > > twice), check out this URL:
> > >
> > > http://www.bjnet.edu.cn/tech/book/seucgi/ch10.htm
> > >
> > > Jeremy
> > >
> > > --- Curtis Hawthorne <cghawthorne@xxxxxxxxx> wrote:
> > > >
> > > > Is it possible to make a CGI program using Perl
> > > that
> > > > will feed the user's browser a file to download
> > > that
> > > > is outside the normal html tree, or one that is
> > > > generated on the fly? If so, how would I do this?
> > > >
> > > > Thanks!
> > > >
> > > > Curtis H.
> > > >
> > > > __________________________________________________
> > > > Do You Yahoo!?
> > > > Yahoo! Shopping - Thousands of Stores. Millions of
> > > > Products.
> > > > http://shopping.yahoo.com/
> > > >
> > > > -- This is the linux-help@xxxxxxxxx list. To
> > > > unsubscribe,
> > > > visit
> > > >
> > >
> > http://tmp2.complete.org/cgi-bin/listargate-aclug.cgi
> > > >
> > > >
> > > >
> > > >
> > >
> > >
> > > __________________________________________________
> > > Do You Yahoo!?
> > > Yahoo! Shopping - Thousands of Stores. Millions of
> > > Products.
> > > http://shopping.yahoo.com/
> > >
> > > -- This is the linux-help@xxxxxxxxx list. To
> > > unsubscribe,
> > > visit
> > >
> > http://tmp2.complete.org/cgi-bin/listargate-aclug.cgi
> > >
> >
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Yahoo! Shopping - Thousands of Stores. Millions of Products.
> > http://shopping.yahoo.com/
> >
> > -- This is the linux-help@xxxxxxxxx list. To unsubscribe,
> > visit http://tmp2.complete.org/cgi-bin/listargate-aclug.cgi
> >
> >
>
>
> -- This is the linux-help@xxxxxxxxx list. To unsubscribe,
> visit http://tmp2.complete.org/cgi-bin/listargate-aclug.cgi
>
>
-- This is the linux-help@xxxxxxxxx list. To unsubscribe,
visit http://tmp2.complete.org/cgi-bin/listargate-aclug.cgi
|
|