uploadfiy2.0+servlet實(shí)現(xiàn)多文件上傳顯示進(jìn)度條

uploadfiy2.0+servlet實(shí)現(xiàn)多文件上傳顯示進(jìn)度條

ID:6033960

大小:134.24 KB

頁(yè)數(shù):5頁(yè)

時(shí)間:2017-12-31

uploadfiy2.0+servlet實(shí)現(xiàn)多文件上傳顯示進(jìn)度條_第1頁(yè)
uploadfiy2.0+servlet實(shí)現(xiàn)多文件上傳顯示進(jìn)度條_第2頁(yè)
uploadfiy2.0+servlet實(shí)現(xiàn)多文件上傳顯示進(jìn)度條_第3頁(yè)
uploadfiy2.0+servlet實(shí)現(xiàn)多文件上傳顯示進(jìn)度條_第4頁(yè)
uploadfiy2.0+servlet實(shí)現(xiàn)多文件上傳顯示進(jìn)度條_第5頁(yè)
資源描述:

《uploadfiy2.0+servlet實(shí)現(xiàn)多文件上傳顯示進(jìn)度條》由會(huì)員上傳分享,免費(fèi)在線閱讀,更多相關(guān)內(nèi)容在行業(yè)資料-天天文庫(kù)。

1、2.1版本簡(jiǎn)單的web項(xiàng)目+servlet實(shí)現(xiàn)的uploadify上傳需要的jar包,commons-fileupload-1.2.1.jar???commons-io-1.3.2.jar???commons-logging-1.1.jar1:簡(jiǎn)單的web結(jié)構(gòu)這里只列舉需要自己修改或?qū)崿F(xiàn)的代碼:upload.javapackage?servlet;import?java.io.File;import?java.io.IOException;import?java.util.Iterator;import?java.ut

2、il.List;import?java.util.UUID;import?javax.servlet.ServletException;import?javax.servlet.http.HttpServlet;import?javax.servlet.http.HttpServletRequest;import?javax.servlet.http.HttpServletResponse;import?org.apache.commons.fileupload.FileItem;import?org.apache.c

3、ommons.fileupload.FileUploadException;import?org.apache.commons.fileupload.disk.DiskFileItemFactory;import?org.apache.commons.fileupload.servlet.ServletFileUpload;@SuppressWarnings("serial")public?class?Upload?extends?HttpServlet?{????@SuppressWarnings("unchecke

4、d")????public?void?doPost(HttpServletRequest?request,?HttpServletResponse?response)????????????throws?ServletException,?IOException?{????????String?savePath?=?this.getServletConfig().getServletContext()????????????????.getRealPath("");????????savePath?=?savePath

5、?+?"/uploads/";????????File?f1?=?new?File(savePath);????????System.out.println(savePath);????????if?(!f1.exists())?{????????????f1.mkdirs();????????}????????DiskFileItemFactory?fac?=?new?DiskFileItemFactory();????????ServletFileUpload?upload?=?new?ServletFileUpl

6、oad(fac);????????upload.setHeaderEncoding("utf-8");????????List?fileList?=?null;????????try?{????????????fileList?=?upload.parseRequest(request);????????}?catch?(FileUploadException?ex)?{????????????return;????????}????????Iterator?it?=?fileList.iterat

7、or();????????String?name?=?"";????????String?extName?=?"";????????while?(it.hasNext())?{????????????FileItem?item?=?it.next();????????????if?(!item.isFormField())?{????????????????name?=?item.getName();????????????????long?size?=?item.getSize();????????????????S

8、tring?type?=?item.getContentType();????????????????System.out.println(size?+?"?"?+?type);????????????????if?(name?==?null?

9、

10、?name.trim().equals(""))?{????????????????

當(dāng)前文檔最多預(yù)覽五頁(yè),下載文檔查看全文

此文檔下載收益歸作者所有

當(dāng)前文檔最多預(yù)覽五頁(yè),下載文檔查看全文
溫馨提示:
1. 部分包含數(shù)學(xué)公式或PPT動(dòng)畫(huà)的文件,查看預(yù)覽時(shí)可能會(huì)顯示錯(cuò)亂或異常,文件下載后無(wú)此問(wèn)題,請(qǐng)放心下載。
2. 本文檔由用戶上傳,版權(quán)歸屬用戶,天天文庫(kù)負(fù)責(zé)整理代發(fā)布。如果您對(duì)本文檔版權(quán)有爭(zhēng)議請(qǐng)及時(shí)聯(lián)系客服。
3. 下載前請(qǐng)仔細(xì)閱讀文檔內(nèi)容,確認(rèn)文檔內(nèi)容符合您的需求后進(jìn)行下載,若出現(xiàn)內(nèi)容與標(biāo)題不符可向本站投訴處理。
4. 下載文檔時(shí)可能由于網(wǎng)絡(luò)波動(dòng)等原因無(wú)法下載或下載錯(cuò)誤,付費(fèi)完成后未能成功下載的用戶請(qǐng)聯(lián)系客服處理。