摘要:一前臺(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/64748.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ī)客戶端無法使用新浪郵箱發(fā)送郵�,隨后我嘗試用登錄新浪郵�,也出現(xiàn)只能接收郵件而不能發(fā)送郵件的情況。三附錄�(cuò)誤碼及建議解決方法發(fā)送郵件成功卻收不到郵件或收到郵件無主題無收件人亂碼新浪郵箱誠(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),哪些性能問題需要特別注意這里我們一起梳理一下本文中我將�,同�(xué)戲稱的系�(tǒng)�(wǎng)易云捕設(shè)�(jì)開發(fā)�(shí)踐中兩年的時(shí)間里碰到的真�(shí)問題,踩過的坑及解決問題的方法和大家一起討論如何解決這些問題� 本文由作者余寶虹授權(quán)�(wǎng)易云社區(qū)�(fā)布� 從零開始�(shè)�(jì)開發(fā)一�(gè)日處理數(shù)�(jù)8億的大數(shù)�(jù)高并�(fā)�(shí)�(shí)系統(tǒng),哪些性能問題需要特別注意?這里我們一起梳理一�,本文中我...
閱讀 2091·2019-08-30 15:53
閱讀 3083·2019-08-30 15:44
閱讀 2941·2019-08-30 14:11
閱讀 2935·2019-08-30 14:01
閱讀 2726·2019-08-29 15:16
閱讀 3795·2019-08-29 13:10
閱讀 1269·2019-08-29 10:56
閱讀 2554·2019-08-26 13:58