<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<from action="smartupload.jsp" method="post" enctype="multipart/form-data">
请选择文件:<input type="file"name="pic">
<input type="submit"value="上传">
</body>
</html>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ page import="org.lxh.smart.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<% SmartUpload smart = new SmartUpload() ;
smart.initialize(pageContext) ; // 初始化上传操作
smart.upload() ; // 上传准备
smart.save("upload") ; //文件保存
%>
</body>
</html>
看了下这个SmartUpload的东西,首先第一个是你的jar包是否导入了。
第二个是上传之前先建立一个upload的文件夹,这个文件夹保存在web根目录下。