//sc.jsp
<%@ page contentType="text/html; charset=gb2312" %>
<html>
<body>
<form name="form1" method="post" action="sc_do.jsp" enctype="multipart/form-data">
<table>
<tr>
<td align="right">图片:</td>
<td colspan="3">
<input name="tp" type="file" id="tp" size="57">
</td>
</tr>
</table>
</form>
</body>
</html>
//sc_do.jsp
<%@ page contentType="text/html; charset=gb2312" %>
<%@ page import="cn.com.jspsmart.upload.*"%>
<%
String tp=mySmartUpload.getRequest().getParameter("tp");
File f;
for (int i=0;i<fs.getCount();i++){
f=fs.getFile(i);
String path="/sc/xxfb/";
if (f.getFileName().length()>0){
if(i==0){
String filename="sctp"+f.getFileName().substring(f.getFileName().lastIndexOf("."),f.getFileName().length());
f.saveAs(path+filename);
tp=filename;
}
}
}
if(tp==null){
tp="null";
}
%>
<script>
window.location.href='sc.jsp';
</script>