aspose file tools*
The moose likes JSF and the fly likes upload file jsf Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "upload file jsf" Watch "upload file jsf" New topic
Author

upload file jsf

Dura Hurtado
Ranch Hand

Joined: Feb 16, 2011
Posts: 120
I am trying to upload a file using primefaces the code is the next one:

<p:fileUpload fileUploadListener="#{fileUploadController.handleFileUpload}"
allowTypes="*.jpg;*.png;*.gif;" description="Images"/>

FileUploadController.java
------------------------

public class FileUploadController {

private Logger logger = LoggerFactory.getLogger(FileUploadController.class);

public void handleFileUpload(FileUploadEvent event) {
logger.info("Uploaded: {}", event.getFile().getFileName());

FacesMessage msg = new FacesMessage("Succesful", event.getFile().getFileName() + " is uploaded.");
FacesContext.getCurrentInstance().addMessage(null, msg);
}
}


┬┐is it right or it incorrect?

Thanks
 
Don't get me started about those stupid light bulbs.
 
subject: upload file jsf