我的smartupload如下放置:
Tomcat 4.1\shared\classes\com\jspsmart\upload\*.class
在jsp中如下调用:
<%@ page import="com.jspsmart.upload.*" %>
<%
//实例化上载bean
com.jspsmart.upload.SmartUpload mySmartUpload=new com.jspsmart.upload.SmartUpload();
//初始化
mySmartUpload.initialize(pageContext);
//设置上载的文件类型
mySmartUpload.setAllowedFilesList("txt,,");;
try{
mySmartUpload.upload();
//取得第一个上载的文件
com.jspsmart.upload.File myFile = mySmartUpload.getFiles().getFile(0);
//取得上载的文件的文件名
String myFileName=myFile.getFileName();
//取得不带后缀的文件名
String suffix=myFileName.substring(0,myFileName.lastIndexOf('.'));
//取得后缀名
String ext= myFile.getFileExt();
//保存路径
String aa="c:\\";
String trace="";
//取得别的参数
//将文件保存在服务器端
aa="c:\\";
trace=aa+myFileName;
myFile.saveAs(trace,mySmartUpload.SAVE_PHYSICAL);
}
catch(Exception e){}
%>
Tomcat 4.1\shared\classes\com\jspsmart\upload\*.class
在jsp中如下调用:
<%@ page import="com.jspsmart.upload.*" %>
<%
//实例化上载bean
com.jspsmart.upload.SmartUpload mySmartUpload=new com.jspsmart.upload.SmartUpload();
//初始化
mySmartUpload.initialize(pageContext);
//设置上载的文件类型
mySmartUpload.setAllowedFilesList("txt,,");;
try{
mySmartUpload.upload();
//取得第一个上载的文件
com.jspsmart.upload.File myFile = mySmartUpload.getFiles().getFile(0);
//取得上载的文件的文件名
String myFileName=myFile.getFileName();
//取得不带后缀的文件名
String suffix=myFileName.substring(0,myFileName.lastIndexOf('.'));
//取得后缀名
String ext= myFile.getFileExt();
//保存路径
String aa="c:\\";
String trace="";
//取得别的参数
//将文件保存在服务器端
aa="c:\\";
trace=aa+myFileName;
myFile.saveAs(trace,mySmartUpload.SAVE_PHYSICAL);
}
catch(Exception e){}
%>
我现在把那五个类打了包,结果他删不掉了。哈哈。