Foros de discusión

Primefaces file upload on live server

El Eng, modificado hace 6 años.

Primefaces file upload on live server

New Member Mensajes: 22 Fecha de incorporación: 2/08/17 Mensajes recientes
Hi,

I am try to upload a file through primefaces and store it in with DLAppService. This works perfectly fine, as long as I am doing it on my local machine.
However as soon as I deploy to our live server, I get Cannot read property 'getElementsByTagName' of null.
This error occurs in primefaces line 1140
var n = h.getElementsByTagName("partial-response")[0];
.

Are there any additional configurations necessary to allow file uploads through jsf/primefaces ?
Also I am using Liferay 7GA4.

Handler:
public void upload (FileUploadEvent event) throws IOException {
this.setPicture(event.getFile());}


JSF:
<p:fileupload id="fileUpload" fileUploadListener="#{uploadBean.upload}" mode="advanced" dragDropSupport="true" sizeLimit="100000" allowTypes="/(\.|\/)(gif|jpe?g|png)$/" />
thumbnail
Neil Griffin, modificado hace 6 años.

RE: Primefaces file upload on live server

Liferay Legend Mensajes: 2655 Fecha de incorporación: 27/07/05 Mensajes recientes
You might want to try clearing your browser cache when visiting the site hosted by the live server. It might be that you have an old primefaces.js cached. If that doesn't work, then please provide the text of the response (hopefully an XML document that starts with a <parital-response> element) here as a forum post attachment.
El Eng, modificado hace 6 años.

RE: Primefaces file upload on live server

New Member Mensajes: 22 Fecha de incorporación: 2/08/17 Mensajes recientes
clearing the cache didn't work.

Also I am not sure how to get the partial response with
h.getElementsByTagName("partial-response")[0];
being null.

I tried loggin the onerror(xhr, status, exception) callback but it seems like it is never called.

Thank you for your help.
thumbnail
Neil Griffin, modificado hace 6 años.

RE: Primefaces file upload on live server

Liferay Legend Mensajes: 2655 Fecha de incorporación: 27/07/05 Mensajes recientes
You can examine the XHR response using Chrome. See attached screenshot which shows the contents of the partial-response after clicking on the "Submit" button of the General use-case for h:inputText in the JSF Showcase.
El Eng, modificado hace 6 años.

RE: Primefaces file upload on live server

New Member Mensajes: 22 Fecha de incorporación: 2/08/17 Mensajes recientes
Thanks for the example.
I tried it, but it just shows
This request has no response data available.


On my local server I get:
<partial-response id="_JSFIdeaBoard_WAR_JSFIdeaBoard_"><changes><extension ln="primefaces" type="args">{"parameterNamespace":"_JSFIdeaBoard_WAR_JSFIdeaBoard_"}</extension><update id="_JSFIdeaBoard_WAR_JSFIdeaBoard_:javax.faces.ViewState:0">9021189885547529217:-8947695983540338547</update></changes></partial-response>
El Eng, modificado hace 6 años.

RE: Primefaces file upload on live server (Respuesta)

New Member Mensajes: 22 Fecha de incorporación: 2/08/17 Mensajes recientes
I figured it out. I was mistakenly using Liferay 7 GA3 on the live server.
After switching to GA4 everything works perfectly.
Sorry for the inconvenience.