Reputation: 11
Does Advanced FileUpload work with MobileRenderKit?
I tried to Upload with following Code :
upload.xhtml:
<h:form enctype="multipart/form-data"
rendered="#{eordner.uploadaktiv}">
<p:fileUpload id="dateiupload" fileUploadListener="#{upload.getfiles}">
</p:fileUpload>
<p:commandButton value="Hochladen..." />
</h:form>
uploadbean.java:
public void getfiles(FileUploadEvent event) {
System.out.println(event.getFile().getFileName());
}
But the fileUploadListener is never invoked.
When I change to normal RenderKit it get invoked.
Is there a solution? I want to able to make mutiple upload.
The simple mode Works fine
I`m on Primefaces 5.2 Tomat 7.0.26 Java 1.0.7 Mojarra 2.2.10
Thanks
Upvotes: 1
Views: 424
Reputation: 1483
Having a look at the PF mobile FileUpload source code:
protected void encodeInputField(FacesContext context, FileUpload fileUpload, String clientId) throws IOException {
ResponseWriter writer = context.getResponseWriter();
writer.startElement("input", null);
writer.writeAttribute("data-role", "none", null);
writer.writeAttribute("type", "file", null);
writer.writeAttribute("name", clientId, null);
if(fileUpload.isMultiple()) writer.writeAttribute("multiple", "multiple", null);
if(fileUpload.getStyle() != null) writer.writeAttribute("style", fileUpload.getStyle(), "style");
if(fileUpload.getStyleClass() != null) writer.writeAttribute("class", fileUpload.getStyleClass(), "styleClass");
if(fileUpload.isDisabled()) writer.writeAttribute("disabled", "disabled", "disabled");
writer.endElement("input");
}
, tells that the advanced mode is not supported, but the multiple
attribute is.
So try with multiple="true"
.
Upvotes: 1