欧美性猛交XXXX免费看蜜桃,成人网18免费韩国,亚洲国产成人精品区综合,欧美日韩一区二区三区高清不卡,亚洲综合一区二区精品久久

打開(kāi)APP
userphoto
未登錄

開(kāi)通VIP,暢享免費電子書(shū)等14項超值服

開(kāi)通VIP
Common file upload組件的使用
 Common file upload組件的使用
Spring, Myface, tomcat manager上傳都是用這個(gè)組件. 可以支持多個(gè)文件上傳的, 習慣了UploadFile和MultipleRequest用用這個(gè)也好, 別太傻瓜了嘛, 或者自己直接從request里面拿內容.
影響當中上傳的會(huì )是類(lèi)似的格式
Contenttype, zip.....
c:\aaa\bbb\cccc.zip
---------------------一些對稱(chēng)的標記符 好像沒(méi)文件長(cháng)度?....
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx文件內容
---------------------對稱(chēng)標記符.


<FORM name=uploadForm action=upload.jsp method=post encType=‘multipart/form-data‘>
Please select one file to upload:
<INPUT type=file size=100 name=uploadFile> <input type=submit name=uploadButton value=‘Start upload‘ onClick="displayLoadingBar(‘Uploading file, please wait...‘)">
</FORM>
<%@page import="org.apache.commons.fileupload.FileItem"%>
<%@page import="java.util.Iterator"%>
<%@page import="java.util.List"%>
<%@page import="java.io.File"%>
<%@page import="org.apache.commons.fileupload.DiskFileUpload"%>
String currentPath = (String) session.getAttribute("currentPath");
DiskFileUpload upload 
= new DiskFileUpload();
   //應該還有個(gè)file thread hole
   //這個(gè)是buffer size?
upload.setSizeMax(
-1);
   //保存的臨時(shí)路徑?
upload.setRepositoryPath(currentPath);

   //這步應該不會(huì )保存上傳文件為臨時(shí)文件吧? 應該只是列表, 適合的FileItem可以獲取到content type
  //大小. 
List items 
= upload.parseRequest(request);
Iterator iter 
= items.iterator();
//We only allow to upload one file right now.
final String UPLOAD_FILE_FIELD = "uploadFile";
FileItem uploadFileItem 
= null;
while (iter.hasNext()) {
    FileItem item 
= (FileItem) iter.next();
    
//System.out.println("fieldName=" + item.getFieldName() + ",isFormField=" + item.isFormField());
    if (!item.isFormField() && UPLOAD_FILE_FIELD.equals(item.getFieldName()) && uploadFileItem == null{
        uploadFileItem 
= item;
    }
        //剩下的這些應該就是form的field, 例如input type=text和其他傳過(guò)來(lái)的參數.
    
else {
        item.delete();
    }

}

if (uploadFileItem == null{
    out.print(
"<font color=red>Upload failed.</font>");
    
return;
}

   //FileItem有個(gè)write的方法, 建議去追下代碼看看具體是把臨時(shí)文件重命名還是拷貝
   //有些人上傳的時(shí)候會(huì )把一些文件改下后綴弄個(gè)把木馬也弄上來(lái)了, 沒(méi)個(gè)殺毒軟件是不行的服務(wù)器.
    public boolean write(File targetFile) {
        try {
            fileItem.write(targetFile);
            return true;
        } catch (Exception e) {
            e.printStackTrace();
            return false;
        }
    }
本站僅提供存儲服務(wù),所有內容均由用戶(hù)發(fā)布,如發(fā)現有害或侵權內容,請點(diǎn)擊舉報。
打開(kāi)APP,閱讀全文并永久保存 查看更多類(lèi)似文章
猜你喜歡
類(lèi)似文章
通過(guò) http 協(xié)議上傳文件
CSDN技術(shù)中心 有關(guān)FileUpload組件的使用和調試的經(jīng)驗
對commons fileupload組件的簡(jiǎn)單封裝
Java實(shí)現圖片上傳源代碼
文件上傳
用commons.fileupload實(shí)現文件的上傳和下載
更多類(lèi)似文章 >>
生活服務(wù)
分享 收藏 導長(cháng)圖 關(guān)注 下載文章
綁定賬號成功
后續可登錄賬號暢享VIP特權!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服

欧美性猛交XXXX免费看蜜桃,成人网18免费韩国,亚洲国产成人精品区综合,欧美日韩一区二区三区高清不卡,亚洲综合一区二区精品久久