nicole.wollgast wrote:
I am using Struts 1.1. I have found the following problem when using
FormFile. If the user enters a nonexistent path into a <html:file> (not
using the FileSelector, but inserting the file directly into the input
field), struts doesn't recognize, that the file doesn't exist. Even a
call to FormFile.getFileData() doesn't throw a FileNotFoundException, it
just returns an empty byte[].
Is this a known bug in Struts? Or what else can go wrong here?
It's been some time since I looked at the code underlying this behaviour,
but as I recall there is no way to distinguish between the user submitting
a non-existent file and a zero-length file. You need to handle both the
same way and either tell the user 'the file you selected is empty or does
not exist' or, depending on what makes sense for your application, just
accept the zero-length file irrespective of whether it existed client side
or not.
Unfortunately you can't solve this client side either (at least not trivially).
L.
--
Laurie, Open Source advocate, Java geek and novice blogger:
http://www.holoweb.net/laurie
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]