国产一级a片免费看高清,亚洲熟女中文字幕在线视频,黄三级高清在线播放,免费黄色视频在线看

打開APP
userphoto
未登錄

開通VIP,暢享免費(fèi)電子書等14項(xiàng)超值服

開通VIP
struts文件上傳- -

struts文件上傳- -

                                      

jsp代碼:

<html:form action="HtmlFile.do" method="post" enctype="multipart/form-data">

select file:

<html:file property="file"/>

<html:submit/>

</html:form>

Form代碼:

private FormFile file;

public FormFile getFile(){return this.file;}

public void setFile(FormFile file){this.file=file;}

Action代碼:

String dir=servlet.getServletContext().getRealPath("/upload");

HtmlFileForm hff = (HtmlFileForm)form;

FormFile file = hff.getFile();

if(file==null){

    return mapping.findForward("success");

}

String  fname = file.getFileName();

String size = Integer.toString(file.getFileSize()+"bytes");

InputStream in = file.getInputStream();

OutputStream out = new FileOutputStream(dir+"/"+fname);

int bytesRead = 0;

byte[] buffer = new byte[8192];

while(bytesRead = in.read(buffer,0,8192)!=-1){

out.write(buffer,0,bytesRead);

}

out.close();

in.close();

本站僅提供存儲(chǔ)服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊舉報(bào)。
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
用struts上傳多個(gè)文件的方法
Struts第3天補(bǔ)充
Struts的文件上傳
用struts向數(shù)據(jù)庫中儲(chǔ)存圖片
MultipartFile 轉(zhuǎn)換為File
web中使用POI導(dǎo)入導(dǎo)出EXCEL文件的例子
更多類似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長圖 關(guān)注 下載文章
綁定賬號(hào)成功
后續(xù)可登錄賬號(hào)暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服