PrimeFaces p:fileUpload Ajax

1

I have a strange problem with the p:fileUpload update of PrimeFaces. I upload an image and save it in a database and this is already working. Here is my code for the p:fileUpload.

<p:fileUpload fileUploadListener="#{playerController.handleFileUpload}" 
        allowTypes="/(\.|\/)(gif|jpe?g|png)$/"
        update="messagePanel preview" />

After the upload i render a h:panelGroup which shows the image.

<h:panelGroup id="preview">
    <p:graphicImage value="#{facesContext.externalContext.contextName}/showProfileImage?&amp;preview=true" alt="#{playerController.selected.image.name}" />
    <h:outputText value="#{playerController.selected.image.name}" />
</h:panelGroup>

In Google Chrome everything is working perfect but in Firefox and Internet Explorer the image does not render when I have already uploaded an image. The old image still appears. After refreshing the page the new image is there.

In FireBug I get this message: "NS_ERROR_NOT_IMPLEMENTED: Component returned failure code: 0x80004001 (NS_ERROR_NOT_IMPLEMENTED) [nsIDOMLSProgressEvent.input]"

I updated all my browsers to the newest version and I am using PrimeFaces 3.5.

ajax
jsf
file-upload
primefaces
asked on Stack Overflow Jun 12, 2013 by stone • edited Jun 22, 2013 by Alexandre Lavoie

2 Answers

0

There is an extra whitespace just before

&preview=true
in your code. I am emphasizing it using * * * here:

<p:graphicImage value="#{facesContext.externalContext.contextName}/showProfileImage?*****&amp;preview=true" alt="#{playerController.selected.image.name}"/>

Remove the whitespace and try it. May be FF and IE doesnt like the space and Chrome is linient

answered on Stack Overflow Jun 12, 2013 by Ammar
0

have you tried removing the template/css components you're using in your project? I have kind of the same problem, and I noticed that if i remove all those components it work fine.

answered on Stack Overflow Jun 21, 2013 by AlexLezama

User contributions licensed under CC BY-SA 3.0