本站首页    管理页面    写新日志    退出

«August 2025»
12
3456789
10111213141516
17181920212223
24252627282930
31


公告

  如果你忍了,欺负你的人将来可能就进监狱了。如果你反击,欺负你的人将来可能就获选十大杰出青年了。

        QQ: 3159671

http://greenboy.javaeye.com/

http://blog.sina.com.cn/u/1278341164 小鸟吹烟


我的分类(专题)

日志更新

最新评论

留言板

链接

Blog信息
blog名称:小鸟吹烟
日志总数:157
评论数量:424
留言数量:-1
访问次数:1256551
建立时间:2006年10月23日




[SSH 学习区]使用struts的控件实现图片上传
随笔,  心得体会,  软件技术

tone 发表于 2007/1/28 22:13:08

1. <html:form action="doSuccessSample.htm" enctype="multipart/form-data" >  <html:hidden property="method" value="addSuccessSample"/>     <html:file property="faceContent" /><br><br>  <html:submit></html:submit></html:form> 2. form里面添加 private FormFile faceContent; public FormFile getFaceContent() {  return faceContent; } public void setFaceContent(FormFile faceContent) {  this.faceContent = faceContent; } 3.使用输出输入流写到本地文件夹,并记录路径进数据库     FormFile face=fileForm.getFaceContent();              ......          InputStream streamIn;         streamIn = face.getInputStream();         OutputStream streamOut=new FileOutputStream(url);         int bytesRead=0;         byte[] buffer=new byte[8192];         while((bytesRead=streamIn.read(buffer,0,8192))!=-1){            streamOut.write(buffer,0,bytesRead);         }


阅读全文(1717) | 回复(0) | 编辑 | 精华
 



发表评论:
昵称:
密码:
主页:
标题:
验证码:  (不区分大小写,请仔细填写,输错需重写评论内容!)



站点首页 | 联系我们 | 博客注册 | 博客登陆

Sponsored By W3CHINA
W3CHINA Blog 0.8 Processed in 0.031 second(s), page refreshed 144765215 times.
《全国人大常委会关于维护互联网安全的决定》  《计算机信息网络国际联网安全保护管理办法》
苏ICP备05006046号