Try flushing the buffer before closing.

pw.flush();

or create the PrintWriter using the output stream and the autoflush flag set
to true.

PrintWriter pw = new PrintWriter(new BufferedWriter( new
FileWriter("C:\\Demo.out"), true);

HTH,

robert

> -----Original Message-----
> From: Stuart Jameson [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, April 23, 2002 8:26 AM
> To: Struts Users Mailing List
> Subject: RE: File upload
>
>
> Hi,
>
> Got a problem with uploading files to the server.
>
> I don't get any errors but the files I try and upload are always empty
>
> Code I'm using in the Action::perform() method looks like this
>
>
>
>             PrintWriter pw = new PrintWriter(
>
>             )
> );
>             int i = in.read();
>             while (i != -1) {
>                 pw.print((char) i);
>                 i = in.read();
>             }
>             pw.close();
>
>
> Demo.out is created but empty.
>
> Any pointers of what I need to add to my jsp page or to my Action
> servlet greatly appreciateed.
>
> --
> To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to