Does form with enctype=“multipart/form-data” cause problems accessing a hidden field

后端 未结 7 2248
失恋的感觉
失恋的感觉 2020-12-18 05:39

I have created a hidden form element

7条回答
  •  心在旅途
    2020-12-18 05:54

    Indeed there is something different.

    request.getParameter will only work for hardcoded URL parameters specified in action attribute of element. In your case it does not contain any.

    All other parameters will be incoded into the form itself, which you have to process by parsing HTTP request's input stream directly.

    Fortunately, you are not the first and there are some good open-source libraries that take care of this.

    I've been using Apache FileUpload. You create a parser and pass a request object to it and then iterate through different items. One of them will be your hidden field.

提交回复
热议问题