Jimmy,

Thanks for the patches, I'll spend today fixing file uploads up using your
code.


-----Original Message-----
From: Jimmy Larsson [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 14, 2001 3:52 AM
To: [EMAIL PROTECTED]
Subject: File uploads (including "patches")



Hi all!

I think struts is a wonderful thing and I have been using it for the last
few weeks. I very pleased with it, except for the file uploading parts.

In our application we've been using file uploads via forms which we have
implemented our selves, but now we want to move to struts and then we need
the uploads working.

These are the issues I've found with the uploading:
1. If you upload a file with a content-type (extension) that the browser
does not know, the first "line" of the file gets truncated.

2. When decoding the multipart request the whole file is stored in memory
as an byte array. You cant have this since users uploding files can fill
up your memory.

3. When reading files in your action you can only read the files as a
bytearray in memory. You cant have this for the same reason as in 2, also
file-io in Java is intended to use streams.

----

I've attached sources for the upload package that fix these issues. 

Because I didn't want to break compability with things using the reading
of byte-arrays, I have not removed the "getFileData()" method from the
FormFile interface. I think this really should be done to prevent users
from using this dangerous method.

If it's ok with you guys I could put some more time into the code and
remove this method, there is also some cleaning up which I have not done.


/Regards, Jimmy Larsson

__________________________________________________________________________
Jimmy Larsson, Lecando AB, http://www.lecando.com                 
  e-mail: [EMAIL PROTECTED]
  Tel: +46 (0)8 - 634 94 00, +46 (0)70 - 462 19 11

Reply via email to