File Upload with Viritin AbstractForm

Hello everyone, is there a way I can upload a picture using the viritin library’s abstract form? My entity has a field of type byte that will be a picture. I can bind the normal properties just fine using the abstract form, but I am not sure how to go about the picture part. Any help?

I would use EasyUploads Add-On for that. EasyUploads is a field, that can be used in a form directly. In the Add-On there is also version with picture preview, which uses byte-array.

Great. This worked. Thanks

Hello, I got it working as I said earlier. Which is great. But I’m not sure how I can controll what is uploaded. For instance, I want to allow only specific file types, eg .jpg, also I want to limit the file size and so on. I’m not sure how to go about it with the current approach.

A look at the EasyUploads api, I notice methods such as setAcceptFilter(String acceptString) and setMaxFileSize(int maxFileSize), but it states those are done on the client and that one should do similar validations on the server. I’m a bit stumped. Thanks