你可以不可以在上传成功以后,通过jsp调用外部工具来实现自动解压?
应该是可行的,不过你必须在服务器上有解压软件。
如果你实现不了,可以到www.zhihuigu.com上求教高人!上传组件目前多采用3种:(1)smartupload (2)oreilly upload (3) struts upload就本人的使用经历,感觉struts的上传相对来说是最简单的了。编程快乐,请访问www.zhihuigu.com,程序员俱乐部网站,讨论技术和学习感受!
应该是可行的,不过你必须在服务器上有解压软件。
如果你实现不了,可以到www.zhihuigu.com上求教高人!上传组件目前多采用3种:(1)smartupload (2)oreilly upload (3) struts upload就本人的使用经历,感觉struts的上传相对来说是最简单的了。编程快乐,请访问www.zhihuigu.com,程序员俱乐部网站,讨论技术和学习感受!
解决方案 »
- struts2+spring+hibernate 登录
- 几个简单web问题
- osworkflow2.8.0自带的例子osworkflow2.8.0-example如何部署到Oracle Application Server 10g中去
- Spring3的源码有多少行?
- 连接数据库思路!!!
- 向高手求救,关于cmp ejb 的级联删除!
- 哪里可以找到如何写.bat批处理文件的文档啊,谢谢!!
- jive问题:编译JiveGlobals.java时出错?
- 请大家指教一下 J2EE 的学习方法和相关的书籍!!!
- 那位推荐一下java用的免费的做统计图的工具。
- 在开发项目中,不管是开发还是系统运行,log是必不可少的。怎样利用log4g做一个便于程序员调用的,内容丰富的log
- struts1.1中要验证文字长度不大于50在validation.xml文件中怎么写??(高分求解,进者有分),菜鸟真苦恼啊!
package com.ut.util;
import java.util.*;
import java.util.zip.*;
import java.io.*;public class MyZip {
private String filename;
private String outputpath;
public void setFilename(String filename) {
this.filename=filename;
}
public void setOutputpath(String outputpath) {
this.outputpath=outputpath;
}
public MyZip() {
}
/**
*
* @param filename 带路径的ZIP文件名
* @param outputpath 解压后输出文件路径
*/
public MyZip(String filename,String outputpath) {
this.filename=filename;
this.outputpath=outputpath;
}
/**
* <p>解压ZIP文件
* @return 返回解压文件名的列表数组
* @throws IOException
*/
public String[] unzip() throws IOException {
if (filename==null) return null;
if (outputpath==null) return null;
FileInputStream f=new FileInputStream(filename);
CheckedInputStream csum=new CheckedInputStream(f,new Adler32());
ZipInputStream in=new ZipInputStream(new BufferedInputStream(csum));
ZipEntry ze;
String s=null;
while((ze=in.getNextEntry())!=null) {
String name=ze.getName();
if (s==null) {
s=name;
}
else {
s=s+"@"+name;
}
FileOutputStream out=new FileOutputStream(outputpath+"\\"+name);
int x;
while ((x=in.read())!=-1) {
out.write(x);
}
out.close();
}
in.close();
return s.split("@");
}
public static void main(String[] args) {
MyZip zip=new MyZip("g:\\tts\\test\\aaa.zip","g:\\tts\\test\\extra\\");
try {
zip.unzip();
}
catch (Exception e) {
e.printStackTrace();
}
}
}