Possible Duplicate:
How to upload files in JSP/Servlet?
In my JSP page I have a field for choosing files, as follows:
   <input type="file" name="uploadFile" id="uploadFile">
And in my action page, I am getting this file as follows:
   File fileUpload=request.getAttribute("fileUpload");
   String fileName="uploadedfile.jpg";
   File target=new File("D:\\",fileName);
   FileUtils.copyFile(file,target);
by using the above code I can upload the file in the named uploadedfile.jpg.But i want to get the file name and type of the uploaded file dynamically from the chosen file.How can i get it?
 
     
    