I'm doing a web app with jsp, I try to make a form that includes a photo in this way
<form name="AddCat" action="../Insertar" method="post" enctype="multipart/form-data">
This form is sent to a servlet that supports multipart
@WebServlet(name = "Insertar", urlPatterns = {"/Insertar"})
@MultipartConfig
And in the dopost method I do the following
String nombre=request.getParameter("nombreCat");
Part archivo = request.getPart("archivos"); //para el input que contiene la foto
InputStream streamArchivo = archivo.getInputStream();
//EL if solo es para checar que haya recibido algo jeje
if(streamArchivo!=null)
{
System.out.println("recibió");
}
else
System.out.println("vació");
System.out.println(nombre);
Since I received that file that apparently if it does, I would like to get the extension of the file and the path where it is to be able to copy it to a special folder within my project, any ideas? Thanks