struts2.0 文件上传问题

liujun_1028 liujun_1028 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
我的代码

public String execute() throws Exception
{
for (int i = 0; i < file.size(); ++i)
{
InputStream is = new FileInputStream(file.get(i));

String root = ServletActionContext.getRequest().getRealPath("/upload");

File destFile = new File(root, this.getFileFileName().get(i));

OutputStream os = new FileOutputStream(destFile);

byte[] buffer = new byte[400];

int length = 0;

while ((length = is.read(buffer)) > 0)
{
os.write(buffer, 0, length);
}

is.close();

os.close();
}

return SUCCESS;

}
问题是 我提交上传后 并没有 在 “upload”文件夹下出现我上传的文件?谁能帮我解惑?(控制台未出现任何异常)
...全文
评论 2
收藏 已收藏
分享
返回顶部
liujun_1028
Web 开发 81,107 成员 341,720 内容