You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Joe Barefoot <Jo...@motiva.com> on 2002/09/28 00:08:55 UTC

RE: send file from action

What do you mean by "send"?  A download?  via email?

> -----Original Message-----
> From: LFung [mailto:lfung@ama.cu]
> Sent: Friday, September 27, 2002 3:19 PM
> To: struts-user@jakarta.apache.org
> Subject: send file from action
> 
> 
> Hi:
> 
> how can I implement an action to send a use a file, for 
> example a .doc file.
> 
> thanks in advance.
> 
> LFung.
> 

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: send file from action

Posted by LFung <lf...@ama.cu>.
I have this code:

<%
      /* HKEY_CLASSES_ROOT\MIME\Database\Content Type */

      response.setContentType("application/msword");
      response.setHeader("Content-Disposition", "attachment; filename=\"" +
"prorroga.doc;" + "\"");
      ServletOutputStream output = response.getOutputStream();

      byte[] inBytes = new byte[128];
      FileInputStream fileInputstream = new
FileInputStream("C:\\resin-2.1.4\\webapps\\intrama\\prorroga.doc");
      int len = fileInputstream.read(inBytes);
      while(len != -1) // Check for EOF
      {
        output.write(inBytes, 0, len);
        len = fileInputstream.read(inBytes);
      }
%>

but the word file is ouputed in the page (to bad)

I am using tiles to conform the page. but I think that this is not the
problem.


----- Original Message -----
From: "LFung" <lf...@ama.cu>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Friday, September 27, 2002 6:15 PM
Subject: Re: send file from action


> I mean download, I reach to open dialog (open / save)
>
> ----- Original Message -----
> From: "Joe Barefoot" <Jo...@motiva.com>
> To: "Struts Users Mailing List" <st...@jakarta.apache.org>
> Sent: Friday, September 27, 2002 3:08 PM
> Subject: RE: send file from action
>
>
> What do you mean by "send"?  A download?  via email?
>
> > -----Original Message-----
> > From: LFung [mailto:lfung@ama.cu]
> > Sent: Friday, September 27, 2002 3:19 PM
> > To: struts-user@jakarta.apache.org
> > Subject: send file from action
> >
> >
> > Hi:
> >
> > how can I implement an action to send a use a file, for
> > example a .doc file.
> >
> > thanks in advance.
> >
> > LFung.
> >
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
>
>
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: send file from action

Posted by LFung <lf...@ama.cu>.
I mean download, I reach to open dialog (open / save)

----- Original Message -----
From: "Joe Barefoot" <Jo...@motiva.com>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Friday, September 27, 2002 3:08 PM
Subject: RE: send file from action


What do you mean by "send"?  A download?  via email?

> -----Original Message-----
> From: LFung [mailto:lfung@ama.cu]
> Sent: Friday, September 27, 2002 3:19 PM
> To: struts-user@jakarta.apache.org
> Subject: send file from action
>
>
> Hi:
>
> how can I implement an action to send a use a file, for
> example a .doc file.
>
> thanks in advance.
>
> LFung.
>

--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>





--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>