package feilo;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import com.opensymphony.xwork.ActionSupport;
public class Upload extends ActionSupport {
File[] doc ;
String[] docContentType ;
String[] docFileName ;
public String execute() throws Exception{
upload();
return SUCCESS ;
}
private void upload() throws Exception{
File file = new File("f:/upload/");
if(!file.exists() || !file.isDirectory()){
file.mkdirs();
}
for(int i=0;i<doc.length;i++){
FileOutputStream outputStream = new FileOutputStream("f:/upload/" + docFileName[i]);
FileInputStream fileIn = new FileInputStream(doc[i]);
byte[] buffer = new byte[1024];
int len;
while ((len = fileIn.read(buffer)) > 0) {
outputStream.write(buffer, 0, len);
}
fileIn.close();
outputStream.close();
}
}
/**
* @param doc the doc to set
*/
public void setDoc(File[] doc) {
this.doc = doc;
}
/**
* @param docContentType the docContentType to set
*/
public void setDocContentType(String[] docContentType) {
this.docContentType = docContentType;
}
/**
* @param docFileName the docFileName to set
*/
public void setDocFileName(String[] docFileName) {
this.docFileName = docFileName;
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
uploadfile.rar (25个子文件)
uploadfile
.project 1KB
.mymetadata 303B
WebRoot
success.jsp 844B
WEB-INF
web.xml 566B
lib
commons-logging.jar 37KB
javamail.jar 347KB
commons-fileupload.jar 53KB
commons-io.jar 82KB
ognl.jar 164KB
xwork.jar 280KB
rife-continuations.jar 114KB
xml-apis.jar 121KB
oscore.jar 89KB
xerces-2.6.2.jar 972KB
webwork-2.2.6.jar 3.23MB
freemarker.jar 784KB
classes
feilo
Upload.class 2KB
webwork.properties 161B
xwork.xml 415B
upload.jsp 671B
META-INF
MANIFEST.MF 39B
.myeclipse
src
feilo
Upload.java 1KB
webwork.properties 161B
xwork.xml 415B
.classpath 1KB
共 25 条
- 1
资源评论
feilo
- 粉丝: 3
- 资源: 8
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功