package com.test;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import org.apache.struts2.ServletActionContext;
import com.opensymphony.xwork2.ActionSupport;
public class UploadAction extends ActionSupport
{
private File fileupload;
private String fileuploadFileName;
private String fileuploadContentType;
public File getFileupload()
{
return fileupload;
}
public void setFileupload(File fileupload)
{
this.fileupload = fileupload;
}
public String getFileuploadFileName()
{
return fileuploadFileName;
}
public void setFileuploadFileName(String fileuploadFileName)
{
this.fileuploadFileName = fileuploadFileName;
}
public String getFileuploadContentType()
{
return fileuploadContentType;
}
public void setFileuploadContentType(String fileuploadContentType)
{
this.fileuploadContentType = fileuploadContentType;
}
@Override
public String execute() throws Exception
{
String realPath = ServletActionContext.getRequest().getRealPath("/img") + "//" + 2;
File file = new File(realPath);
file.mkdirs();
InputStream is = new FileInputStream(fileupload);
byte[] buf = new byte[1024];
int length = 0 ;
OutputStream os = new FileOutputStream(new File(realPath, fileuploadFileName));
while(-1 != (length = is.read(buf) ) )
{
os.write(buf, 0, length) ;
}
is.close();
os.close();
return null;
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
Uploadify.zip (35个子文件)
Uploadify
.settings
org.eclipse.wst.jsdt.ui.superType.name 6B
com.genuitec.eclipse.core.prefs 134B
org.eclipse.wst.common.project.facet.core.xml 252B
org.eclipse.wst.common.component 465B
org.eclipse.wst.jsdt.ui.superType.container 49B
.jsdtscope 500B
org.eclipse.jdt.core.prefs 395B
src
com
test
UploadAction.java 2KB
struts.xml 441B
.project 2KB
WebRoot
css
uploadify.css 2KB
image
uploadify-cancel.png 3KB
uploadify.swf 12KB
META-INF
MANIFEST.MF 36B
WEB-INF
web.xml 567B
classes
com
test
UploadAction.class 2KB
struts.xml 441B
lib
xwork-core-2.3.15.1.jar 625KB
javassist-3.11.0.GA.jar 600KB
asm-tree-3.3.jar 21KB
commons-io-2.0.1.jar 156KB
struts2-core-2.3.15.1.jar 783KB
freemarker-2.3.19.jar 909KB
asm-3.3.jar 43KB
ognl-3.0.6.jar 223KB
commons-logging-1.1.3.jar 61KB
asm-commons-3.3.jar 37KB
commons-fileupload-1.3.jar 67KB
log4j-1.2.17.jar 478KB
commons-lang3-3.1.jar 308KB
js
jquery-1.8.2.min.js 91KB
jquery.uploadify.js 64KB
index.jsp 2KB
.mymetadata 300B
.classpath 529B
.myeclipse
共 35 条
- 1
资源评论
- julongren2014-01-23参考了。很好,学习了。
晦涩的天空
- 粉丝: 0
- 资源: 2
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功