-
Notifications
You must be signed in to change notification settings - Fork 778
Closed
Labels
🐞 defectBug...Something isn't workingBug...Something isn't workingthird-partyIssue is tracked in 3rd party libraryIssue is tracked in 3rd party library
Milestone
Description
Describe the bug
If i use p:valiadteFile with a variable in sizeLimit (fileUploadView.size) it doesn't consider it at runtime.
<h:form id="frmTest">
<p:growl id="growl" sticky="true" showDetail="true"/>
<p:inputText value="#{fileUploadView.size}" >
<p:ajax update="xx,input20" />
</p:inputText>
<h:outputText id="xx" value="#{fileUploadView.size}" />
<p:fileUpload id="input20" update="growl"
listener="#{fileUploadView.handleFileUpload}"
mode="advanced" dragDropSupport="true" auto="true" >
<p:validateFile sizeLimit="#{fileUploadView.getSizeLimit(fileUploadView.size)}" allowTypes="/(\.|\/)(gif|jpeg|jpg|png)$/" />
</p:fileUpload>
</h:form>@Named
@RequestScoped
public class FileUploadView {
private UploadedFile file;
private String size;
public void upload() {
if (file != null) {
FacesMessage message = new FacesMessage("Successful", file.getFileName() + " is uploaded.");
FacesContext.getCurrentInstance().addMessage(null, message);
}
}
public void handleFileUpload(FileUploadEvent event) {
FacesMessage message = new FacesMessage("Successful", event.getFile().getFileName() + " is uploaded.");
FacesContext.getCurrentInstance().addMessage(null, message);
}
public UploadedFile getFile() {
return file;
}
public void setFile(UploadedFile file) {
this.file = file;
}
public String getSizeLimit(String limit) {
if (limit != null) {
return limit;
}
return "100000";
}
@PostConstruct
public void init() {
setSize("70000");
}
public String getSize() {
return size;
}
public void setSize(String size) {
this.size = size;
}
}Reproducer
No response
Expected behavior
No response
PrimeFaces edition
None
PrimeFaces version
14.0.2
Theme
No response
JSF implementation
Mojarra
JSF version
4.0
Java version
17
Browser(s)
No response
Metadata
Metadata
Assignees
Labels
🐞 defectBug...Something isn't workingBug...Something isn't workingthird-partyIssue is tracked in 3rd party libraryIssue is tracked in 3rd party library