[prev in list] [next in list] [prev in thread] [next in thread]
List: struts-user
Subject: Re: FormFile.getFileData() not throwing FileNotFoundException?
From: "Martin Gainty" <mgainty () hotmail ! com>
Date: 2005-07-31 12:30:11
Message-ID: BAY103-DAV7497EF9FBECEB20B87884AEC00 () phx ! gbl
[Download RAW message or body]
Folks-
I found an example of implementing a FileUploadBean via a taglib. Take note
of the doUpload method reads the InputStream from the request which of
course bring back 0 length string and you can take it from there..
http://forums.devshed.com/t56547/s.html
HTH,
Martin-
----- Original Message -----
From: "Laurie Harper" <laurie@holoweb.net>
To: <user@struts.apache.org>
Sent: Saturday, July 30, 2005 6:48 PM
Subject: Re: FormFile.getFileData() not throwing FileNotFoundException?
> 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: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic