读取文件时出错
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { InputStream in = request.getInputStream(); String tempFile = "G:/tempFile"; File temp = new File(tempFile); FileOutputStream out = new FileOutputStream(temp); byte[] b = new byte[1024]; int n; while((n=in.read(b))!=-1){ out.write(b,0,n); } in.close(); out.close(); }
为什么我读取的内容是myfile=test.txt然后就没有了?