You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by bu...@apache.org on 2003/10/24 18:35:13 UTC
DO NOT REPLY [Bug 24108] New: -
Opera-Fileupload-Items are not recognized if empty
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=24108>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=24108
Opera-Fileupload-Items are not recognized if empty
Summary: Opera-Fileupload-Items are not recognized if empty
Product: Commons
Version: 1.0 Final
Platform: PC
OS/Version: Other
Status: NEW
Severity: Critical
Priority: Other
Component: File Upload
AssignedTo: commons-dev@jakarta.apache.org
ReportedBy: wknauf@hg-online.de
CC: wknauf@hg-online.de
Defining a fileupload-control on a webpage:
<input type="file" name="File1">
Then I parse the request by FileUpload:
org.apache.commons.fileupload.DiskFileUpload fileUpload = new
org.apache.commons.fileupload.DiskFileUpload();
...some initialization
//Process request:
java.util.List list = fileUpload.parseRequest( request );
//Loop through the fields:
for (int i = 0; i < list.size(); i++)
{
org.apache.commons.fileupload.FileItem fileItem =
(org.apache.commons.fileupload.FileItem) list.get(i);
//Check type:
if (fileItem.isFormField() == true)
{
//Form-Field:
System.out.println ( "IsFormField: " + fileItem.isFormField() + ",
FieldName: " + fileItem.getFieldName() + ": " + fileItem.getString("ISO-8859-
1") );
}
else
{
//File !
System.out.println ( "IsFormField: " + fileItem.isFormField() + ",
FieldName: " + fileItem.getFieldName() + ", File: " + fileItem.getName() + ": "
+ fileItem.getContentType() );
}
}
The output looks like this with Opera (5 File-Upload-Items, Item 1 has a valid
file):
IsFormField: false, FieldName: File1, File: thecorrectfilename.txt: text/plain
IsFormField: true, FieldName: File2:
IsFormField: true, FieldName: File3:
IsFormField: true, FieldName: File4:
IsFormField: true, FieldName: File5:
What you see is that empty FileUpload-Fields are recognized as formfields.
(hope that I didn't break important info while modifiying the code and output
to a more readable form).
My Opera version is 7.21.
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org