File Upload

4 messages Options
Embed this post
Permalink
Anand Shankar-2

File Upload

Reply Threaded More More options
Print post
Permalink
Hello

I am facing more problem about File Upload and anybody is helping me. I have
listed my problem on all the open source forum, so please give me your some
important moment to suggest that how can I solve this problem.


I am using a form with enctype="multipart/form-data" in order to upload
files from the form.
I have read this page: http://commons.apache.org/fileupload/using.html and
everything works well for my form.

The only problem is that I can't get all the values from a "multiple select"
html object. I get only one value.

Using servlets I have used this method:

*public* java.lang.String[] getParameterValues(java.lang.String name)



But now I have enctype="multipart/form-data" in my form and I can't use this
way...
Is there a way to get all the values of a multi-valued parameter?


Thanks a lot!

--
Anand Shankar
jitesh dundas-2

Re: File Upload

Reply Threaded More More options
Print post
Permalink
Hi Anand,

In your html form for multiple select, have you set the attribute "multiple" ?

i.e. <select name="selDropList" multiple>

This will allow you to post multiple values. Then you get the values as

request.getParameter() as an array in string..

Try this and let me know if still you face problems..

Regards,
Jitesh Dundas



On 10/14/09, Anand Shankar <[hidden email]> wrote:

> Hello
>
> I am facing more problem about File Upload and anybody is helping me. I have
> listed my problem on all the open source forum, so please give me your some
> important moment to suggest that how can I solve this problem.
>
>
> I am using a form with enctype="multipart/form-data" in order to upload
> files from the form.
> I have read this page: http://commons.apache.org/fileupload/using.html and
> everything works well for my form.
>
> The only problem is that I can't get all the values from a "multiple select"
> html object. I get only one value.
>
> Using servlets I have used this method:
>
> *public* java.lang.String[] getParameterValues(java.lang.String name)
>
>
>
> But now I have enctype="multipart/form-data" in my form and I can't use this
> way...
> Is there a way to get all the values of a multi-valued parameter?
>
>
> Thanks a lot!
>
> --
> Anand Shankar
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

James Carman

Re: File Upload

Reply Threaded More More options
Print post
Permalink
In reply to this post by Anand Shankar-2
The parameters from your form aren't sent as usual when you use
multipart form data.  They are sent as "parts."  So, as you iterate
through the FileItem objects from your upload, some of them will be
form fields.  You can check by calling isFormField().  You can call
getFieldName() to get the field name and getString() to get the
field's value.  Check out this document for more information:

http://commons.apache.org/fileupload/using.html


On Wed, Oct 14, 2009 at 12:02 AM, Anand Shankar <[hidden email]> wrote:

> Hello
>
> I am facing more problem about File Upload and anybody is helping me. I have
> listed my problem on all the open source forum, so please give me your some
> important moment to suggest that how can I solve this problem.
>
>
> I am using a form with enctype="multipart/form-data" in order to upload
> files from the form.
> I have read this page: http://commons.apache.org/fileupload/using.html and
> everything works well for my form.
>
> The only problem is that I can't get all the values from a "multiple select"
> html object. I get only one value.
>
> Using servlets I have used this method:
>
> *public* java.lang.String[] getParameterValues(java.lang.String name)
>
>
>
> But now I have enctype="multipart/form-data" in my form and I can't use this
> way...
> Is there a way to get all the values of a multi-valued parameter?
>
>
> Thanks a lot!
>
> --
> Anand Shankar
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Martin Cooper-3

Re: File Upload

Reply Threaded More More options
Print post
Permalink
In reply to this post by Anand Shankar-2
On Tue, Oct 13, 2009 at 9:02 PM, Anand Shankar <[hidden email]> wrote:

> Hello
>
> I am facing more problem about File Upload and anybody is helping me. I have
> listed my problem on all the open source forum, so please give me your some
> important moment to suggest that how can I solve this problem.
>
>
> I am using a form with enctype="multipart/form-data" in order to upload
> files from the form.
> I have read this page: http://commons.apache.org/fileupload/using.html and
> everything works well for my form.
>
> The only problem is that I can't get all the values from a "multiple select"
> html object. I get only one value.

Are you *asking* for more than one value? Or are you only asking for
the first one?

Iterate.

--
Martin Cooper


> Using servlets I have used this method:
>
> *public* java.lang.String[] getParameterValues(java.lang.String name)
>
>
>
> But now I have enctype="multipart/form-data" in my form and I can't use this
> way...
> Is there a way to get all the values of a multi-valued parameter?
>
>
> Thanks a lot!
>
> --
> Anand Shankar
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]