jsp request and form's enctype="multipart/form-data" problem
liliya woland
Ranch Hand
Joined: Apr 11, 2006
Posts: 134
posted
0
Hello every one, I'm having a difficulty implementing "multipart/form-data" in my form. When I use <FORM name="mail" action="http://live:8080/jsps/send.jsp" enctype="multipart/form-data" method="POST"> the request in send.jsp CAN NOT see any data of the form, and when I pull enctype="multipart/form-data" out of the form, request can access every piece of information in the form. I have to have enctype="multipart/form-data" in my form for later usage by an Apache library. Can anyone please tell me what's happening here and IF can I have both - enctype="multipart/form-data" in the form AND have the request accessing the data in the form? Thanks in advance.
Adeel Ansari
Ranch Hand
Joined: Aug 15, 2004
Posts: 2874
posted
0
request.getParameter() doesn't work with multipart/form-data. You can use commons fileupload library. You can retrieve multipart request values by using that library.
So, commons.fileupload libraries by Apache (are these the ones you're talking about?) do use a request for instanciation. And, catch 22, they require multipart to be true when request gets passed as a parameter in order to instanciate the libraries. So I just don't know what I need to have happening in the form and the code to successfuly use these Apache libraries. If anyone used commons.fileupload, please respond. Thanks in advance.
Adeel Ansari
Ranch Hand
Joined: Aug 15, 2004
Posts: 2874
posted
0
Originally posted by liliya woland: So I just don't know what I need to have happening in the form and the code to successfuly use these Apache libraries. If anyone used commons.fileupload, please respond. Thanks in advance.
You can write and configure a seperate resource, such as filter, to handle multipart requests. you need is to define your form as multipart/form-data. For more please refer to Using Commons Fileupload.