I'm working on a project and I need to know if the file type input has something to insert it into the DB, I was trying to validate if it was different from null, but even if I don't put any file, it enters as if it were different from null.
iPart part = request.getPart("aFoto");
if (part != null) {
InputStream inputStream = part.getInputStream();
c.setFoto(inputStream);
}
Do it from the html/jsp and put the following:
The accept is to accept the extensions of a file type or several, as in this case you separate them by ,
Oh, and the required is so the client can't leave that field empty.
For everyone with this doubt, this is the answer...