O'Reilly logo

PrimeFaces Cookbook by Mert Çalışkan, Oleg Varaksin

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Basic, automatic, and multiple file upload

The fileUpload component provides a file upload mechanism with enhanced features as compared to the basic HTML <input type="file"> file upload definition. The component provides an HTML5-powered UI with capabilities such as drag-and-drop, uploading multiple files, and progress tracking, and it will also support legacy browsers (for IE v6, v7, v8, and v9) for compatibility by degrading gracefully.

How to do it...

Firstly, the PrimeFaces FileUpload Filter must be defined in the web.xml file to parse incoming multipart file upload requests. It should map to the Faces Servlet definition.

<filter> <filter-name>PrimeFaces FileUpload Filter</filter-name> <filter-class> org.primefaces.webapp.filter.FileUploadFilter ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required