[请问高手]关于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取,放到隐藏域中,提交后就可以得到了,哈哈 javabean从servlet转递到JSP页面的问题 EL表達式的奇怪問題 java如何实现“注册码”功能 JSTL标签显示oracle的timestamp字段问题 调用webservice中文显示乱码 SSH框架希望进入JSP页面就显示商品列表,为什么没有显示?请大家来帮小弟看看! 运行客户端LxClient提示出错 NoClassDefFoundError 很简单的问题啊 帮我看看啊,偶是初学者啊 struts问题让我疑惑了很久。 那里有RSA的JAVA库 求教:关于用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();
}
}