You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Eric Chow <er...@gmail.com> on 2005/01/18 11:21:52 UTC

Multipart File Upload

Hello,

How can I upload multi files with differents HTML form fields at th e
same FORM ?

How can I get the specific field by giving its name in JSP ? For
instance, I want to get the file name of File1 and the description22,
how can I do that ?


The following is a FORM example,


<form name="Form1" enctype="multipart/form-data" method="post"
action="upload.jsp">
<p>File 1<input type="file"name="File1" size="20" maxlength="20"> </p>
<p>Description 1.1<input type="text" name="File11" size="30"
maxlength="50"> </p>
<p>Description 1.2<input type="text" name="File12" size="30"
maxlength="50"> </p>
<p>File 2<input type="file" name="File2" size="20" maxlength="20"> </p>
<p>Description 2.1<input type="text" name="File21" size="30"
maxlength="50"> </p>
<p>Description 2.2<input type="text" name="File22" size="30"
maxlength="50"> </p>
<p>File 3<input type="file" name="File3" size="20" maxlength="20"> </p>
<p>Description 3.1<input type="text" name="File31" size="30"
maxlength="50"> </p>
<p>Description 3.2<input type="text" name="File32" size="30"
maxlength="50"> </p>
<p> <input type="submit"value="Upload"> <input type="reset" value="Clear"> </p>
</form>


Eric

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: Multipart File Upload

Posted by Martin Cooper <mf...@gmail.com>.
On Tue, 18 Jan 2005 18:21:52 +0800, Eric Chow <er...@gmail.com> wrote:
> Hello,
> 
> How can I upload multi files with differents HTML form fields at th e
> same FORM ?

Exactly as you are doing in the example you give below.

> How can I get the specific field by giving its name in JSP ? For
> instance, I want to get the file name of File1 and the description22,
> how can I do that ?

Iterate over the List returned by parseRequest(), call getFieldName()
and test for the value(s) you want.

--
Martin Cooper


> The following is a FORM example,
> 
> <form name="Form1" enctype="multipart/form-data" method="post"
> action="upload.jsp">
> <p>File 1<input type="file"name="File1" size="20" maxlength="20"> </p>
> <p>Description 1.1<input type="text" name="File11" size="30"
> maxlength="50"> </p>
> <p>Description 1.2<input type="text" name="File12" size="30"
> maxlength="50"> </p>
> <p>File 2<input type="file" name="File2" size="20" maxlength="20"> </p>
> <p>Description 2.1<input type="text" name="File21" size="30"
> maxlength="50"> </p>
> <p>Description 2.2<input type="text" name="File22" size="30"
> maxlength="50"> </p>
> <p>File 3<input type="file" name="File3" size="20" maxlength="20"> </p>
> <p>Description 3.1<input type="text" name="File31" size="30"
> maxlength="50"> </p>
> <p>Description 3.2<input type="text" name="File32" size="30"
> maxlength="50"> </p>
> <p> <input type="submit"value="Upload"> <input type="reset" value="Clear"> </p>
> </form>
> 
> Eric
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org