File f = new File("c:\test.txt");
f.delete();

解决方案 »

  1.   

    可以删除的,就是上传的时候在数据库中设置记录,然后按dmhorse(dmhorse) (就可以删除了!
      

  2.   

    In servlet,you also can find doDelete method implement of the httpservlet interface.
    But I never use,you may try as that.Before you use f.delete(),pls while f.isFile(),f.exist() to judge the file existing or not.
      

  3.   

    我代码和错误如下: 确定c:\test.txt 存在。 这是什么原因啊?
    ------------------------------------------------
    <%@ page contentType="text/html;charset=gb2312"%>
    <%@ page language="java" import="com.jspsmart.upload.*"%>
    <jsp:useBean id="myUpload" scope="page" class="com.jspsmart.upload.SmartUpload" />
    <%
    File f = new File("c:\test.txt");
    //f.delete();
    %>
    ------------------------------------
    500 Servlet Exception
    Note: sun.tools.javac.Main has been deprecated.
    /well-being/2222222editor/save.jsp:21: Wrong number of arguments in constructor.
           Files fff =new File("c:\test.txt");
                      ^
    1 error, 1 warning
      

  4.   

    Files fff =new File("c:\test.txt");
    why Files???