multipart/form-data enctype ignored

梦想与她 提交于 2020-03-26 07:52:09

问题


I have defined a form as multipart/form-data enctype. When I press a command button the request is not send with 'multipart/form-data' content-type.

<h:form id="form" method="post" enctype="multipart/form-data">

     <input type="file" ></input>

     <p:commandButton id="save" icon="saveBt" value="#{msgs.saveBt}" ... />

</h:form>

In the developer tools console I can see the Content-Type as application/x-www-form-urlencoded; charset=UTF-8.

I'm working with JSF 2.1 and Primefaces 5.1.

Thanks


回答1:


You are using JSF and Primefaces, so use <p:fileUpload> instead of <input type="file">. Take a look at official demo for an example.



来源:https://stackoverflow.com/questions/28715559/multipart-form-data-enctype-ignored

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!