Posts

Showing posts from December 18, 2009

file upload using servlet

Hi friends Here is the example to upload a file using java servlet technology. <table> <tbody> <tr> <form action="http://your_host/servlet/UploadServlet?your_config" enctype="multipart/form-data" method="post"> <td> <input name="fname" size="20" type="file" /> </td> <td> <input type="Submit" value="Upload" /> </td> </form> </tr> </tbody></table> import java.io.File; import java.io.IOException; import java.util.Iterator; import java.util.List; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.fileupload.DiskFileUpload; import org.apache.commons.fileupload.FileItem; import org.apache.commons.fileupload.FileItemFactory; import org.apache.commons.fileuploa...