I'm having trouble with a code. I am creating a form with a profile photo, but when I make a change of the photo in the EDIT, I would like the photo to be deleted from the images folder. Today I can only delete and change the photo, but the old one remains. The code below is what I use to exclude a record from my list:
public void apagar(UsuarioModel selcionado){
if (selecionado != null){
try{
if (new UsuarioDao().apagar(selecionado)){
lista.remove(selcionado);
}
}catch(Exception e){
System.out.println(e.getMessage());
}
}
}