问题
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