@ManagedBean
public class FileUploadView {
private UploadedFile file;
public UploadedFile getFile() {
return file;
}
public void setFile(UploadedFile file) {
this.file = file;
}
public void upload() {
if(file != null) {
FacesMessage message = new FacesMessage("Succesful", file.getFileName() + " is uploaded.");
FacesContext.getCurrentInstance().addMessage(null, message);
System.out.println(file.getFileName() + " is uploaded.");
}
}
}
How can I get the name of the file uploaded ?
-
- Posts: 277
- Joined: 08 Jul 2013, 17:53
Your own pasted code tells you how to get the file name.
-
- Information
-
Who is online
Users browsing this forum: No registered users and 58 guests