[请问高手]关于FormFile类的问题 干嘛要用struts标签呢,我觉得好麻烦,现在公司也没人用 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 public static void saveFile(String filename, FormFile file, String path) throws FileNotFoundException, IOException { if (file.getFileSize() > 0) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); InputStream stream = file.getInputStream(); createDir(path); OutputStream bos = new FileOutputStream(path + File.separator + filename); int bytesRead = 0; byte[] buffer = new byte[8192]; while ((bytesRead = stream.read(buffer, 0, 8192)) != -1) { bos.write(buffer, 0, bytesRead); } bos.close(); stream.close(); } } 更正一下,formfile是个接口,直接取好想取不到,可以用javascript 通过javascript取,放到隐藏域中,提交后就可以得到了,哈哈 Spring返回jason数据到jqgrid不显示 在深圳合适的工作好难找啊! 收集一下,面高级软件工程师的题目 当用户从客户端输入注册信息后(输入Email),怎样实现对他的Email中发送一条注册成功的邮箱信息? 60 关于JAVA日期的问题,兄弟们帮帮我呀! 急!!请教各位高手!!关于tomcat的使用的问题! 高分求救(急),问题比较简单 hibernate 主键的类型 设置tomcat的连接池出错,请各位大哥帮忙? 求教:关于用eclipse开发struts的配置问题 会做即时通讯软件的朋友请进
throws FileNotFoundException, IOException {
if (file.getFileSize() > 0) {
ByteArrayOutputStream baos = new ByteArrayOutputStream(); InputStream stream = file.getInputStream();
createDir(path);
OutputStream bos =
new FileOutputStream(path + File.separator + filename);
int bytesRead = 0;
byte[] buffer = new byte[8192];
while ((bytesRead = stream.read(buffer, 0, 8192)) != -1) {
bos.write(buffer, 0, bytesRead);
}
bos.close();
stream.close();
}
}