Uploading files via AJAX with p: fileUpload with mode = "advanced"
I have this piece of code that downloads files:
<p:dialog id="addFileDialog"
header="#{text['tasksbacking.attach.addFile']}"
widgetVar="addfile"
height="500"
width="500"
closeOnEscape="true"
resizable="false"
draggable="false"
fitViewport="true"
modal="true"
appendTo="@(body)">
<h:form enctype="multipart/form-data">
<p:fileUpload fileUploadListener="#{attachmentsComponent.handleFileUpload}"
mode="advanced"
multiple="true"
dragDropSupport="true"
allowTypes="/(\.|\/)(gif|jpe?g|png|pdf|doc|docx|txt)$/"
label="#{text['tasksbacking.addFile.choose']}"
uploadLabel="#{text['tasksbacking.addFile.upload']}"
cancelLabel="#{text['tasksbacking.addFile.cancel']}"/>
</h:form>
<p:ajax event="close"
update=":#{cc.clientId}:addFileDialog,:#{cc.clientId}:formAttachForm:attachTree,:#{cc.clientId}:formAttachForm:msgTreeAction,:#{cc.clientId}:attachContainer" listener="#{attachmentsComponent.onCloseUpload}"/>
</p:dialog>
With this code, I can upload files when I close the dialog. But I cannot perform another AJAX action without refreshing the page. Other actions run well when I don't upload files as the first action.
What could be the problem to perform direct actions without refreshing the page? Could it be a enctype
form problem ?
+3
source to share