Struts action 中使用jspsmartupload 上传文件
2007-11-22 16:40
381 查看
以下是execute中代码,其中用到GetFile.jar和jspSmartUpLoad.jar两个包文件(我的资源空间都有收藏)。
getFile.GetFile getfiles= new getFile.GetFile();
String[] glist = getfiles.Dirlist("E:/test","");
SmartUpload su = new SmartUpload();
su.initialize(this.getServlet().getServletConfig(), request, response);
su.upload();
for(int i=0;i<su.getFiles().getCount();i++){
File file = su.getFiles().getFile(i);
if(file.isMissing())continue;
for(int k=0;k<glist.length;k++){
String file1=glist[k];
String file2=file.getFileName();
if(file1.equals(file2)){
System.out.println("与服务器中文件名重复,请修改文件名,重新上传!");
return;
}
}
System.out.println("fileName:"+file.getFileName());
}
int count = su.save("E:/test");
System.out.println(" >>>> "+count+" 个文件上传成功!");
getFile.GetFile getfiles= new getFile.GetFile();
String[] glist = getfiles.Dirlist("E:/test","");
SmartUpload su = new SmartUpload();
su.initialize(this.getServlet().getServletConfig(), request, response);
su.upload();
for(int i=0;i<su.getFiles().getCount();i++){
File file = su.getFiles().getFile(i);
if(file.isMissing())continue;
for(int k=0;k<glist.length;k++){
String file1=glist[k];
String file2=file.getFileName();
if(file1.equals(file2)){
System.out.println("与服务器中文件名重复,请修改文件名,重新上传!");
return;
}
}
System.out.println("fileName:"+file.getFileName());
}
int count = su.save("E:/test");
System.out.println(" >>>> "+count+" 个文件上传成功!");
相关文章推荐
- Java Web中使用JSPSmartUpload控件实现文件的上传和下载(解决了中文乱码问题)(JSP页面采用GBK编码)
- 使用smartupload组件实现jsp+jdbc上传下载文件实例解析
- 在jsp中使用smartupload组件上传文件
- 今天使用jspsmartupload.jar实现上传文件的功能,发现中文乱码,于是总结了下解决方法
- JSP 使用smartupload上传文件,JSP+servlet
- 使用jspSmartUpload组件进行文件上传、下载
- 使用jspSmartUpload实现文件的上传
- 在jsp中使用smartupload组件上传文件ggg
- 在jsp中使用smartupload组件上传文件- -
- 在jsp中使用smartupload组件上传文件
- jsp使用jspSmartUpload实现多文件上传
- 使用jspSmartUpload组件进行文件上传、下载
- JSP+Servlet使用jspsmartupload实现文件上传至服务器
- 项目开发技巧(四):使用JspSmartupload实现文件上传下载(一):JspSmart之upload组件源码及使用
- 使用jspSmartUpload组件进行文件上传、下载
- 使用jspSmartUpload组件进行文件上传、下载、批量下载
- Java Web中使用JSPSmartUpload控件实现文件的上传和下载(解决了中文乱码问题)(JSP页面采用GBK编码)
- 在jsp中使用smartupload组件上传文件
- 使用JspSmartUpload组件上传文件
- 使用jspsmartupload完成简单的文件上传系统