Ok hai ragione scusa.
Ecco il codice che ho inserito nella mia servlet:
public void doPost(HttpServletRequest req,HttpServletResponse res)
throws ServletException, IOException
{
res.setContentType("text/html");
PrintWriter pw = res.getWriter();
pw.println("<html>");
pw.println("<head><title>Hello</title></head>");
pw.println("<body>");
FileUpload fileUpload = new FileUpload();
List list = null;
try
{
list = fileUpload.parseRequest(req);
}
catch(FileUploadException ex)
{
throw new ServletException("Wrapped",ex);
}
Iterator iter = list.iterator();
while (iter.hasNext()) {
FileItem item = (FileItem) iter.next();
if (!item.isFormField()) {
File itemFile = new File(item.getName());
File destDir = new File(getServletContext().getRealPath("/")
+"FileUploadFatture");
if(!destDir.exists()) {
destDir.mkdirs();
}
File destFile = new File(getServletContext().getRealPath("/")
+"FileUploadFatture"+File.separator+itemFile.getNa me());
pw.println(item);
pw.println(destFile);
try
{
item.write(destFile);
}
catch(Exception ex)
{
//throw new ServletException("Wrapped",ex);
pw.println(ex.getMessage());
}
}
}
pw.println("</body>");
pw.println("</html>");
pw.close();
}
il punto in cui mi va in errore è questo:
list = fileUpload.parseRequest(req);
pare che non riconosca parseRequest,e qui mi si blocca.
Graziee

Rispondi quotando
