2.1 have a bug in FileItem.write().

Here is a workaround:

FileItem file = pp.getFileItem( "fileName" );
if (file.inMemory())
{
   FileWriter writer = new FileWriter( destination );
   writer.write( file.getString() );
   writer.close(); // Missing in FileItem.writer()
}
else
{
   file.write( destination );
}

If I only knew how to make a patch I would submit one...

Paal Hagerup


Gunter Miessbrandt wrote:
> Hi,
> I have problems with UploadService.
> When I try to upload a file FileItem
> often writes 0 bytes long file. The upload work fine as long as the file is
> a jpg-graphic. With other extensions it doesn?t work. Sometimes the
> jpg-files are only half loaded.
> My Turbine Version is 2.1.
> 
> Here's the code that I use to upload the file:
> FileItem fileItem =
> data.getParameters().getFileItem("file");
> fileItem.write(TurbineServlet.getRealPath("uploaded.file"));
> 
> The form in the template file is with "enctype" set to
> "multipart/form-data".
> I have searched the archives but found no answer.
> 
> Thanks in advance for any help I get!
> Gunter Miessbrandt
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 




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

Reply via email to