You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Jason Webber <we...@mminternet.com> on 2002/02/06 00:57:46 UTC

CSV File

I want the browser to download the file and not display a CSV file that
I have created.  Right now I issue the following commands, but it
doesn't seem to work.. Any ideas are appreciated.


String file;
...

response.setHeader("Content-length","file.length()");
response.setHeader("Content-type","application/octetstream");
response.setHeader("Content-disposition","inline;
filename=\"report.csv\"");
out.print(file);


--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>


Re: CSV File

Posted by Attila Szegedi <sz...@freemail.hu>.
IE ignores the Content-Type and makes a guess on content type based on the
content itself. If it recognizes a plain text content, it will display it as
such no matter what the Content-Type. However, Content-Disposition should
help.

Attila.

----- Original Message -----
From: "Gary Helmling" <gh...@panix.com>
To: "Tomcat Users List" <to...@jakarta.apache.org>
Sent: 2002. február 6. 21:13
Subject: Re: CSV File


> On Tue, 2002-02-05 at 18:57, Jason Webber wrote:
> > I want the browser to download the file and not display a CSV file that
> > I have created.  Right now I issue the following commands, but it
> > doesn't seem to work.. Any ideas are appreciated.
> >
> >
> > String file;
> > ...
> >
> > response.setHeader("Content-length","file.length()");
> > response.setHeader("Content-type","application/octetstream");
> > response.setHeader("Content-disposition","inline;
> > filename=\"report.csv\"");
> > out.print(file);
> >
>
> Try setting the Content-disposition header to
> "attachment; filename=\"report.csv\"".  You may also need to use an
> unknown mime-type to get this to work in all versions of IE.  If it does
> not work with "application/octet-stream", try something like
> "application/x-vnd-yourcompany".
>
> Hope this helps.
>
>
> --g
>
>
> --
> To unsubscribe:   <ma...@jakarta.apache.org>
> For additional commands: <ma...@jakarta.apache.org>
> Troubles with the list: <ma...@jakarta.apache.org>
>
>


--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>


Re: CSV File

Posted by Gary Helmling <gh...@panix.com>.
On Tue, 2002-02-05 at 18:57, Jason Webber wrote:
> I want the browser to download the file and not display a CSV file that
> I have created.  Right now I issue the following commands, but it
> doesn't seem to work.. Any ideas are appreciated.
> 
> 
> String file;
> ...
> 
> response.setHeader("Content-length","file.length()");
> response.setHeader("Content-type","application/octetstream");
> response.setHeader("Content-disposition","inline;
> filename=\"report.csv\"");
> out.print(file);
> 

Try setting the Content-disposition header to 
"attachment; filename=\"report.csv\"".  You may also need to use an
unknown mime-type to get this to work in all versions of IE.  If it does
not work with "application/octet-stream", try something like 
"application/x-vnd-yourcompany".

Hope this helps.


--g


--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>