简体   繁体   English

PrimeFaces fileUpload在IE <= 9上不起作用

[英]PrimeFaces fileUpload doesn't work on IE<=9

The problem occurs only in IE<=9. 仅在IE <= 9中出现此问题。 Everywhere else fileupload works perfectly. 在其他任何地方,fileupload都可以完美运行。

I'm using PrimeFaces version: 3.4.2. 我正在使用PrimeFaces版本:3.4.2。 Upgrading to 4.0 doesn't change anything. 升级到4.0不会有任何改变。

I've copied code from: PrimeFaces FileUpload demo 我复制了以下代码: PrimeFaces FileUpload演示

<h:form>

            <p:fileUpload fileUploadListener="#{fileUploadBean.listener}"
                mode="advanced" update="messages" auto="true" sizeLimit="100000"
                allowTypes="/(\.|\/)(gif|jpe?g|png)$/" />

            <p:growl id="messages" showDetail="true" />

        </h:form>

I've even defined: 我什至定义了:

<meta http-equiv="X-UA-Compatible" content="IE=8" />

On my page it's not working but on FileUpload demo page it's suprisingly working. 在我的页面上它不起作用,但是在FileUpload演示页面上它令人惊讶地起作用。

I've noticed this strange behaviour on IE <= 9 (Content-Length is 0 and Content-Type is not present - why?): 我注意到IE <= 9上的这种奇怪行为(Content-Length为0,而Content-Type不存在-为什么?):

我的页面请求

But on PrimeFaces page there is (the same browser - IE8/9): 但是在PrimeFaces页面上有(同一浏览器-IE8 / 9):

素面要求

I've also tried to set enctype to multipart/form-data and (like on PrimeFaces demo page) application/x-www-form-urlencoded (which is default) 我还尝试将enctype设置为multipart/form-data和(例如在PrimeFaces演示页上) application/x-www-form-urlencoded (默认设置)

What can I do to get this to work? 我该怎么做才能使它正常工作?

You could try to experiment with the primefaces.UPLOADER param if you haven't yet. 如果尚未尝试使用primefaces.UPLOADER参数,则可以尝试。 I had to use 我不得不用

<context-param>
    <param-name>primefaces.UPLOADER</param-name>
    <param-value>commons</param-value>
</context-param>

to make it work on IE8. 使它可以在IE8上运行。 Maybe that helps for you, too 也许对您也有帮助

I've just resolved it. 我已经解决了

The reason why it didn't work was that in the layout - XHTML masterpage there were included jquery and jquery.fileupload... but why IE<=9 didn't handle that I don't know (no errors/warnings in the console). 它不起作用的原因是在布局中-XHTML母版中包含了jquery和jquery.fileupload ...但是为什么IE <= 9不能处理我不知道的问题(没有错误/警告)安慰)。

I just modified it to that below: 我只是将其修改为以下内容:

<o:conditionalComment if="gt IE 9">
    <script src="#{request.contextPath}/js/jquery.min.js"></script>
    <script src="#{request.contextPath}/js/jquery-ui.min.js"></script>
    <script src="#{request.contextPath}/js/jquery.fileupload.js"></script>
</o:conditionalComment>

Now it works. 现在可以了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM