文件上传,找个包或者自己做个class都可以

解决方案 »

  1.   

    从浏览器post来的流包括了各种表单的.
    所以你要对这些表单进行分类.
    具体怎么弄.俺也不知道.
      

  2.   

    都四个三角,不知道你怎么混来的,我费好大劲才得了三个三角具体做法可以把获得的数据流转换成字符串,然后对字符串进行分析写一个class就是为了这个目的,如果不想写就找一个别人做好的吧如果是自己学习还是建议自己写class
      

  3.   

    public class streamRead extends HttpServlet {
      private static final String CONTENT_TYPE = "text/html; charset=GBK";
      //Initialize global variables
      public void init() throws ServletException {
      }
      //Process the HTTP Get request
      public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        //response.setContentType(CONTENT_TYPE);
        PrintWriter out = response.getWriter();
        out.println("<html>");
        out.println("<head><title>streamRead</title></head>");
        out.println("<body bgcolor=\"#ffffff\">");
        out.println("<p>The servlet has received a " + request.getMethod() + ". This is the reply.</p>");
        out.println("</body></html>");
      }
      //Process the HTTP Post request
      public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
          byte mStream[]=null;
          int totalRead = 0;
          int readBytes = 0;
          int totalBytes = 0;
          try
          {
            totalBytes = request.getContentLength();
            System.out.println(totalBytes);
            mStream = new byte[totalBytes];
            while (totalRead < totalBytes) {
              request.getInputStream();
              readBytes = request.getInputStream().read(mStream, totalRead,
                                                        totalBytes - totalRead);
              totalRead += readBytes;
            }
            String filename=request.getParameter("filename");
            System.out.println(filename);
            FileOutputStream fs;
        
            fs = new FileOutputStream("d:/"+filename);
            fs.write(mStream);
            fs.flush();
            fs.close();
        
    OutputStream OutBinarry=response.getOutputStream() ;
    OutBinarry.write(mStream) ;
    OutBinarry.flush();
    OutBinarry.close();
          }     catch (Exception e)
         {
           System.out.println(e.toString());
         }  }
      //Process the HTTP Put request
      public void doPut(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        System.out.println("begin to execute put method!");  }  //Process the HTTP Delete request
      public void doDelete(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        System.out.println("begin to execute delete method!");
      }
      //Clean up resources
      public void destroy() {
      }
      

  4.   

    keyong19ryry(随风逐月) 拜托,别误会,这个不是我的号,呵呵,我接来用的