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 ...

Get PrimeFaces Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.