Solución
Finalmente logre solucionar el problema cambiando la función Upload.jsp
a un servle upload.java
mucho mas simplificado. Dejo a continuación el código.
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.MultipartConfig;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.Part;
/**
* Servlet implementation class upload
*/
@WebServlet("/upload")
@MultipartConfig
public class upload extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
Part filePart = request.getPart("file"); // Recibe el <input type="file" name="file">
String fileName = Paths.get(filePart.getSubmittedFileName()).getFileName().toString(); // MSIE fix.
// InputStream fileContent = filePart.getInputStream();
File uploads = new File("C:\\img\\");
File file = File.createTempFile("WebApp-", ".enc", uploads);
try (InputStream fileContent1 = filePart.getInputStream()){
Files.copy(fileContent1, file.toPath(), StandardCopyOption.REPLACE_EXISTING);
request.setAttribute("Correcto", "Archivo guardado con exito!");
RequestDispatcher rd = request.getRequestDispatcher("/index.jsp");
rd.forward(request, response);
}catch(Exception ex) {
System.out.println("Error: "+ ex);
}
}
}