- 导入jar包
- jsp页面
3. 创建sevlet代码如下 public class Shangchuan extends HttpServlet {
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
SmartUpload su=new SmartUpload();//创建上传对象
su.initialize(this.getServletConfig(), request, response);//初始化
try {
su.upload();//加载到内存
su.save("upp");//文件放入到upp文件夹
} catch (SmartUploadException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}