commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Priest <Robert.Pri...@bentley.com>
Subject RE: fileupload name issue
Date Mon, 25 Aug 2003 15:03:00 GMT
Try fi.getFieldName().

-----Original Message-----
From: Harshad Oak [mailto:harshadoak@hotpop.com]
Sent: Monday, August 25, 2003 7:03 AM
To: commons-user@jakarta.apache.org
Subject: fileupload name issue 


Hello,

I am trying to use the FileUpload 1.0 component to upload three files from
an HTML page. I am submitting an HTML form to a JSP page.

The HTML is as follows:
    <FORM name="filesForm" action="ProcessFileUpload.jsp"
    method="post" enctype="multipart/form-data">
        File 1:<input type="file" name="file1"/><br/>
        File 2:<input type="file" name="file2"/><br/>
        File 3:<input type="file" name="file3"/><br/>
        <input type="submit" name="Submit" value="Upload Files"/>
    </FORM>

In the JSP I have a statement (fi is a reference to
org.apache.commons.fileupload.FileItem):

    System.out.println("NAME: "+fi.getName()); 

Strangely enough, if I submit the form using Opera browser version 7.11, the
output of the System.out in the JSP is just the <fileName>. However on
trying to submit it using Internet Explorer 5.5, the output is the entire
path eg: D:/<directoryname>/<filename>

Is this a known issue and what is the solution for it? I just need the name
and not the entire path to the file. I found a possible workaround in an
onjava.com article. However if this bug has been fixed in the latest CVS
copy, I could pick that up.

thanks,
harshad

Mime
View raw message