Foros de discusión

How to validate file to be uploaded?

Kush Sahu, modificado hace 11 años.

How to validate file to be uploaded?

Junior Member Mensajes: 25 Fecha de incorporación: 7/08/12 Mensajes recientes
I am working on liferay project. I have to put file upload functionality. For which I have used

<bridge:inputFile/>

But my upload method is not called when I try to upload a blank file of 0 bytes. Actually my validation for blank file is inside my upload method.
thumbnail
Neil Griffin, modificado hace 11 años.

RE: How to validate file to be uploaded?

Liferay Legend Mensajes: 2655 Fecha de incorporación: 27/07/05 Mensajes recientes
I tried this with the jsf2-portlet demo the other day, and uploading a zero-byte file will cause the jsf2-portlet to catch the error and display an error message to the user.

So I would recommend that you look at the ApplicantBackingBean.handleFileUpload(FileUploadEvent) method and also there is a class in the bridge called RequestParameterMapMultiPartImpl.java that might be where the error message gets caught.