You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by Will Holcomb <wi...@himinbi.org> on 2003/02/22 20:08:03 UTC
Re: exception when uploading files with empty fields
On Sat, 22 Feb 2003, Johnny Quazar wrote:
> Yes I got stuck on this problem too, at 2.1, and spent time looking
> into it only to decide there wasn't any good way to pass a clean "no
> file 5 submitted" indication.
I'm not sure I understand this. Are you saying you wanted the api to
designate that say only 4 of the 5 fields were filled in? I think if you
were wanting to do this then you could have getFileItems() return an array
of length 5 with the fifth item null.
I think a better behavior though would simply to return an array of length
4. What giving all the files the same name in the html designates is that
they are all for the same purpose. It the first file has a certain meaning
and the second file a different meaning then they shouldn't all be named
the same thing.
If I needed all 5 files filled in then I can still check the length of the
array.
> Will, I will try to hack around on this myself again, maybe I'll have
> better luck.
I found where the actual problem is happening. It is true that there are
only two put's into the parameters table in BaseValueParser, but in
DefaultParameterParser which subclasses it and accesses parameters there
is a put of a FileItem[] in:
275 public void append(String name, FileItem value)
This is what is causing the class cast exception (since base value parser
in casting everything coming out of parameters to a String[].) Personally
I think if I were doing it I would keep a separate table of the file
uploads. What should happen if someone had a form with a text input and a
file upload named the same thing? That's going to be a problem with both
in the same table.
I'd do a patch myself except the system I am working on is supposed to go
live on Wednesday, so this isn't the best time. =)
Will
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org