zoukankan      html  css  js  c++  java
  • 上传文件 java程序员

    String filePath = "c:/";
      String fileName = request.getParameter("title");
            InputStream inputStream =request.getInputStream();
            FileOutputStream outputStream = new FileOutputStream(new File(filePath+fileName+".png"));
           
      //int formlength = request.getContentLength();
      int formlength = Integer.parseInt(request.getParameter("file"));
      byte[] formcontent = new byte[formlength];
      int totalread = 0;
      int nowread = 0;
      while (totalread < formlength) {
       nowread = inputStream.read(formcontent, totalread, formlength);
       totalread += nowread;
      }

            outputStream.write(formcontent);
            outputStream.flush();
            outputStream.close();
            inputStream.close();

  • 相关阅读:
    VMware搭建VMware ESXi 6.7
    77. Combinations
    47. Permutations II
    system design
    37. Sudoku Solver
    12月9日学习日志
    12月8日学习日志
    12月7日学习日志
    12月6日学习日志
    12月5日学习日志
  • 原文地址:https://www.cnblogs.com/java20130725/p/3215731.html
Copyright © 2011-2022 走看看