multipart/form-data编码类型被忽略 [英] multipart/form-data enctype ignored

查看:424
本文介绍了multipart/form-data编码类型被忽略的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已将表单定义为multipart/form-data编码类型.当我按下命令按钮时,请求发送的内容类型不是"multipart/form-data".

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>

在开发人员工具控制台中,我可以看到Content-Type为application/x-www-form-urlencoded; charset = UTF-8.

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

我正在使用JSF 2.1和Primefaces 5.1.

I'm working with JSF 2.1 and Primefaces 5.1.

谢谢

推荐答案

您正在使用JSF和Primefaces,因此请使用<p:fileUpload>而不是<input type="file">.以官方演示为例.

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

这篇关于multipart/form-data编码类型被忽略的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆