摘要:一前臺(tái)頁(yè)面捷易拍控件測(cè)試程序啟動(dòng)主啟動(dòng)副停止保存保存保存保存保存保存灰度圖參數(shù)設(shè)置設(shè)置去黑邊自動(dòng)矯正設(shè)置分辨率設(shè)置圖片壓縮率圖片壓縮率大小必須在之間創(chuàng)建目錄創(chuàng)建目錄成功刪除目錄刪除目錄成功刪除刪除文件成功測(cè)試啟動(dòng)主啟動(dòng)副停
一.前臺(tái)頁(yè)面:
捷易拍控件測(cè)試程序
二.后臺(tái)頁(yè)面:(注意需要的jar包,commons-fileupload-1.3.jar,commons-io-2.4.jar)
package com.jaeyi; import java.io.File; import java.io.IOException; import java.io.PrintWriter; import java.util.Iterator; import java.util.List; 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.commons.fileupload.FileUploadException; import org.apache.commons.fileupload.disk.DiskFileItemFactory; import org.apache.commons.fileupload.servlet.ServletFileUpload; public class UploadServlet extends HttpServlet { private static final long serialVersionUID = 1L; private String tempPath = "d:upload emp";//臨時(shí)目錄 private String path = "d:upload";//上傳目錄 public UploadServlet(){ super(); } public void destroy() { super.destroy(); } public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { this.doGet(request, response); } /** * The doGet method of the servlet.
* * This method is called when a form has its tag value method equals to get. * * @param request * the request send by the client to the server * @param response * the response send by the server to the client * @throws ServletException * if an error occurred * @throws IOException * if an error occurred */ public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setCharacterEncoding("GBK"); request.setCharacterEncoding("GBK"); DiskFileItemFactory fac = new DiskFileItemFactory(); fac.setSizeThreshold(1024); fac.setRepository(new File(tempPath)); ServletFileUpload upload = new ServletFileUpload(fac); upload.setFileSizeMax(1024*1024*5); try { ListfileList = upload.parseRequest(request); Iterator iter = fileList.iterator(); while(iter.hasNext()){ FileItem fileItem = (FileItem)iter.next(); if(!fileItem.isFormField()){ String name = fileItem.getName(); String fileSize = new Long(fileItem.getSize()).toString(); if(name == null || name.equals("") || fileSize.equals("0")) continue; name = name.substring(name.lastIndexOf("")+1); File saveFile = new File(new File(path),name); fileItem.write(saveFile); } } } catch (Exception e) { e.printStackTrace(); throw new ServletException(e); } } public void init() throws ServletException { if(!new File(tempPath).exists()){ new File(tempPath).mkdirs(); } if(!new File(path).exists()){ new File(path).mkdirs(); } } }
文章版權(quán)歸作者所有,未經(jīng)允許請(qǐng)勿轉(zhuǎn)載,若此文章存在違規(guī)行為,您可以聯(lián)系管理員刪除。
轉(zhuǎn)載請(qǐng)注明本文地址:http://systransis.cn/yun/86236.html
摘要:一前臺(tái)頁(yè)面捷易拍控件測(cè)試程序啟動(dòng)主啟動(dòng)副停止保存保存保存保存保存保存灰度圖參數(shù)設(shè)置設(shè)置去黑邊自動(dòng)矯正設(shè)置分辨率設(shè)置圖片壓縮率圖片壓縮率大小必須在之間創(chuàng)建目錄創(chuàng)建目錄成功刪除目錄刪除目錄成功刪除刪除文件成功測(cè)試啟動(dòng)主啟動(dòng)副停 一.前臺(tái)頁(yè)面: 捷易拍控件測(cè)試程序 //啟動(dòng)主 function Start1_onclick() { captrue.b...
摘要:網(wǎng)上也有不少人反饋用手機(jī)客戶端無(wú)法使用新浪郵箱發(fā)送郵件,隨后我嘗試用登錄新浪郵箱,也出現(xiàn)只能接收郵件而不能發(fā)送郵件的情況。三附錄錯(cuò)誤碼及建議解決方法發(fā)送郵件成功卻收不到郵件或收到郵件無(wú)主題無(wú)收件人亂碼新浪郵箱誠(chéng)信平臺(tái) 前言 ??JavaMail的使用本身并不難,網(wǎng)上有不少案例,簡(jiǎn)單易懂,而且有詳細(xì)的中文注解。但是由于JavaMail的機(jī)制設(shè)置不夠完善,特別是異常出錯(cuò)時(shí)的參考信息太少,給...
摘要:從零開始設(shè)計(jì)開發(fā)一個(gè)日處理數(shù)據(jù)億的大數(shù)據(jù)高并發(fā)實(shí)時(shí)系統(tǒng),哪些性能問(wèn)題需要特別注意這里我們一起梳理一下本文中我將以,同學(xué)戲稱的系統(tǒng)網(wǎng)易云捕設(shè)計(jì)開發(fā)實(shí)踐中兩年的時(shí)間里碰到的真實(shí)問(wèn)題,踩過(guò)的坑及解決問(wèn)題的方法和大家一起討論如何解決這些問(wèn)題。 本文由作者余寶虹授權(quán)網(wǎng)易云社區(qū)發(fā)布。 從零開始設(shè)計(jì)開發(fā)一個(gè)日處理數(shù)據(jù)8億的大數(shù)據(jù)高并發(fā)實(shí)時(shí)系統(tǒng),哪些性能問(wèn)題需要特別注意?這里我們一起梳理一下,本文中我...
閱讀 2466·2021-11-25 09:43
閱讀 1287·2021-11-24 09:39
閱讀 809·2021-11-23 09:51
閱讀 2435·2021-09-07 10:18
閱讀 1944·2021-09-01 11:39
閱讀 2822·2019-08-30 15:52
閱讀 2634·2019-08-30 14:21
閱讀 2903·2019-08-29 16:57