留言板

Primefaces file upload on live server

El Eng,修改在6 年前。

Primefaces file upload on live server

New Member 帖子: 22 加入日期: 17-8-2 最近的帖子
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,修改在6 年前。

RE: Primefaces file upload on live server

Liferay Legend 帖子: 2655 加入日期: 05-7-27 最近的帖子
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,修改在6 年前。

RE: Primefaces file upload on live server

New Member 帖子: 22 加入日期: 17-8-2 最近的帖子
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,修改在6 年前。

RE: Primefaces file upload on live server

Liferay Legend 帖子: 2655 加入日期: 05-7-27 最近的帖子
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,修改在6 年前。

RE: Primefaces file upload on live server

New Member 帖子: 22 加入日期: 17-8-2 最近的帖子
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,修改在6 年前。

RE: Primefaces file upload on live server (答复)

New Member 帖子: 22 加入日期: 17-8-2 最近的帖子
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.