try {
SmartUpload mySmartUpload = new SmartUpload();
mySmartUpload.initialize(pageContext); //初始化
mySmartUpload.setMaxFileSize(500 * 1024*1024);//设置上载的最大值
mySmartUpload.upload();//上载文件
com.jspsmart.upload.File myFile = mySmartUpload.getFiles().getFile(0);
if (!myFile.isMissing())
{
}
else{
if (!myFileName.equals( "")){
System.out.println(("上载!!!文件不存在").toString());
}
else{
System.out.println(("没有附件上载!").toString());
}
}
}catch (Exception e) {
System.out.println("上载文件和保存文件信息时出错!" + e);
}
SmartUpload mySmartUpload = new SmartUpload();
mySmartUpload.initialize(pageContext); //初始化
mySmartUpload.setMaxFileSize(500 * 1024*1024);//设置上载的最大值
mySmartUpload.upload();//上载文件
com.jspsmart.upload.File myFile = mySmartUpload.getFiles().getFile(0);
if (!myFile.isMissing())
{
}
else{
if (!myFileName.equals( "")){
System.out.println(("上载!!!文件不存在").toString());
}
else{
System.out.println(("没有附件上载!").toString());
}
}
}catch (Exception e) {
System.out.println("上载文件和保存文件信息时出错!" + e);
}
String fpath=System.getProperty("user.home")+fs+"esp"+fs;SmartUpload su=new SmartUpload();
su.initialize(pageContext);
su.setMaxFileSize(1000000);//设置每个文件的最大长度
su.setTotalMaxFileSize(2000000);
su.setAllowedFilesList("doc,txt,xls");
su.setDeniedFilesList("exe,bat,jsp,htm,html,,");
su.upload();
int count = su.save(fpath);
System.out.println(count+"个文件上传成功!");