i'm having a problem to get the fullPath of a file which i upload using primefaces component . This is my code:
<h:form prependId="false" enctype="multipart/form-data">
<p:fileUpload update="@form" mode="advanced" auto="true"
fileUploadListener="#{myBean.myFileUpload}"/>
<h:outputText value="#{myBean.fileName}"/>
</h:form>
@ManagedBean
@SessionScoped
public class MyBean {
private String fileName;
public void myFileUpload(FileUploadEvent event) {
FacesMessage msg = new FacesMessage("Succesful", event.getFile().getFileName() + " is uploaded.");
FacesContext.getCurrentInstance().addMessage(null, msg);
fileName = event.getFile().getFileName();
}
public String getFileName() {
return fileName;
}
public void setFileName(String fileName) {
this.fileName = fileName;
}
}
i only get the file's name but what i really want to get is the full path. i already try this but it doesn't show anything.
fileName = FilenameUtils.getFullPath(event.getFile().getFileName());