I have a problem with uploaded gif (or *.doc) files
having size zero but jpg or tif are fine. I consulted
the archive. I found the thread below explaining the
same problem, a work around, and a fix notice (which I
don't experience - probably not supposed to yet :). I
tried the workaround in the archive. I also looked
through the turbine and fulcrum source code but I
don't see how content-type in FileItem could cause
this problem.
Is the problem caused by the content-type? Why? I'm
trying to understand what's going on.
<I found these in the mailing list archive>
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]
>
>
This has now been fixed in the DefaultFileItem.java in
jakarta-turbine-fulcrum
Thanks.
FYI, you should wrap the above in a try/finally so
that you can be assured
it is closed if the write fails for some reason.
-jon
</I found these in the mailing list archive>
=====
"I'm concerned about a better world. I'm concerned about justice; I'm concerned about
brotherhood; I'm concerned about truth. And when one is concerned about that, he can
never advocate violence. For through violence you may murder a murderer, but you can't
murder murder. Through violence you may murder a liar, but you can't establish truth.
Through violence you may murder a hater, but you can't murder hate through violence.
Darkness cannot put out darkness; only light can do that."
-M. L. King, Jr., 16 August 1967
__________________________________________________
Do You Yahoo!?
Make a great connection at Yahoo! Personals.
http://personals.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]