Hi Bo,

I think I use the same class then you.

my .jsp File looks like this:

<%@ page import="com.oreilly.servlet.*" %>
<%@ page import="com.oreilly.servlet.multipart.*" %>

<%
try
{
  MultipartRequest multi=new
MultipartRequest(request,"\\jakarta-tomcat\\webapps\\weblight2\\uploads\\",
10000000);

  Enumeration params=multi.getParameterNames();
  Enumeration files=multi.getFileNames();


  File f=null;

   String f_name=null;
   while(files.hasMoreElements()){
           f_name=(String)files.nextElement();
           f_name=f_name.trim();
           String st_type=multi.getContentType(f_name);
           f=multi.getFile(f_name);
   }

if(f!=null){
   FileInputStream fis=new FileInputStream(f);
   FileOutputStream fos=new FileOutputStream(f_name);
   int b;
   while((b=fis.read())!=-1){
        fos.write((byte)b);
    }
   fis.close();fos.close();
}
}//end of try
catch (Exception e)
{
out.println("ERROR : "+e.toString());
}
%>

But as far as I remember I got it also from the page I got the classes
from.

Sascha


Reply via email to