这是上传的程序 
<%@ page language="java" contentType="text/html; charset=gb2312" %>
<%@ page language="java" import="com.jspsmart.upload.*"%>
<%@ page import="java.util.Date"%>
<%@ page import="java.io.File"%>
<%@ include file="/common/config.jsp" %>
<jsp:useBean id="DoDateBean" scope="page" class="com.kaxi.info.common.DoDate" />
<jsp:useBean id="DoTextBean" scope="page" class="com.kaxi.info.common.DoText" />
<jsp:useBean id="mySmartUpload" scope="page" class="com.jspsmart.upload.SmartUpload" />
<jsp:useBean id="ReOutputBean" scope="page" class="com.kaxi.info.common.ReOutput" /><HTML>
<BODY BGCOLOR="white">
<%
String DateFilename= "";
String Datedir= "";
String FilePath=path+"upimages/";

//取得时间
Date dCurr = new Date();
//按时间取得文件名
DateFilename=DoDateBean.fotmatDate3(dCurr);
DateFilename=DoTextBean.DateFileEncode(DateFilename);

//按时间取得目录名
Datedir=DoDateBean.fotmatDate4(dCurr);
Datedir=DoTextBean.DateFileEncode(Datedir);

//目录路径
FilePath=FilePath+Datedir;

try {
//初始化
mySmartUpload.initialize(pageContext);
//设置文件大小
mySmartUpload.setTotalMaxFileSize(1000000);
//文件上传
mySmartUpload.upload();

//取得上传文件
com.jspsmart.upload.File myFile = mySmartUpload.getFiles().getFile(0);
//取得文件名
DateFilename=DateFilename+"."+myFile.getFileExt(); //创建目录
File myFilePath=new File(FilePath); if(!myFilePath.exists())
{
myFilePath.mkdir();
} //判断文件是否上传成功
if(!myFile.isMissing()){
//判断文件大小
if (myFile.getSize()<102400) {
//判断文件类型
if (myFile.getFileExt().equals("jpg") || myFile.getFileExt().equals("gif") || myFile.getFileExt().equals("swf")) {
//保存文件
myFile.saveAs("/upimages/"+Datedir+"/"+DateFilename);
//out.println("您上传的文件大小是: " + myFile.getSize() + "<BR>");
//out.println("文件名是: " + DateFilename + "<BR>"); out.print("<script language=javascript>");
out.print("alert('图片上传成功!!');");
out.print("parent.window.location.reload();");
out.print("window.location= (sample1.htm);"); 
out.print("</script>");

//out.println("<img src=/upload/"+Datedir+"/"+DateFilename+" >");
}
else{
out.print(ReOutputBean.ReOutput(false,"只能上传JPG GIF SWF的文件!!","javascript:history.go(-1);"));
}

}
else{
out.print(ReOutputBean.ReOutput(false,"文件大不能超过100K","javascript:history.go(-1);"));
}


}
else{
out.print(ReOutputBean.ReOutput(false,"文件上传失败","javascript:history.go(-1);"));
}

} catch (Exception e) { 
out.println(e.toString());
}

%></BODY>
</HTML>