How do I recognize in a servlet whether the request sent using HTML form has enctype multipart/form-data
or the default application/x-www-form-urlencoded
?
Alternatively: is there any other way to recognize which form was used? request.getParameter("some_param")
works only with default encoding.
Use Apache Commons FileUpload's own
ServletFileUpload#isMultipartContent()
to check it.See also: