0

I follow this tutorial to parse multipart request. To this code in first line I add

String user = request.getParameter("username");

But my code stop working after that. How can I parse the request.

Mxyk
  • 10,678
  • 16
  • 57
  • 76
nyanev
  • 11,299
  • 6
  • 47
  • 76
  • There's nothing wrong with that specific line of code. Are you sure the username parameter is being passed in with the request? – Jeremy Aug 09 '11 at 10:13

1 Answers1

2

request.getParameter("username"); implies that you are trying to read a form field. In that event, you must read the request parameter and it's value using FileItem.getFieldName() and FileItem.getString methods.

HttpServletRequest.getParameter will not work in such an event, since it is meant to be used to process URL-encoded data in the query string or in the POST body.

Vineet Reynolds
  • 76,006
  • 17
  • 150
  • 174