呵呵,Sorry,应该是security方面的问题,你用全路径试试

解决方案 »

  1.   

    http://www.jguru.com/search/results.jsp?resource=jGuru:forum/IO&query=delete&offset=10
      

  2.   

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <%@ page contentType="text/html;"%>
    <%@ page import="java.io.*"%>
    <%@ page import="client.PubFunc"%><%
    PubFunc pub = new PubFunc();
    client.TableCtrl query = new client.TableCtrl();
    String archivetypename = pub.decodeGB(pub.nullToStr(request.getParameter("archivetype_name")));

    String sqlarchivetype="select archivetype_type from archivetype where archivetype_name = " + pub.toSqlStr(archivetypename,1);java.util.Vector vecarchivetype = query.open(sqlarchivetype);
    int rCount = vecarchivetype.size();
    if (rCount <=0){
    return;
    }String[] ret=(String [])vecarchivetype.firstElement();
    String retarchivetype = ret[0];String archive_name = pub.nullToStr(request.getParameter("archive_name"));
    String archive_recount = pub.nullToStr(request.getParameter("archive_recount"));
    String archive_type= pub.nullToStr(retarchivetype);
    //修改资料名称数据库内容
    int rec = -1;
    String Msg = "";
    try{
    String maxid = String.valueOf(query.maxId("archivemanager","archive_id")); String sql="Insert into archivemanager (archive_id,archive_num,archive_type,archive_name,archive_recount) "
    + "  Values("+ maxid + "," + maxid + pub.toSqlStr(archive_type,0) 
    + pub.toSqlStr(archive_name,0) + pub.toSqlStr(archive_recount,0) +  ")";
    rec = query.exec(pub.decodeGB(sql)); //修改资料内容数据库内容
    String[] adddoc = (String[])session.getValue("Session_adddoc");
    String maxidcon;
    String sqlcon; for(int i=0; i<adddoc.length; i++){
    maxidcon = String.valueOf(query.maxId("archivecon","con_id"));
    sqlcon ="Insert into archivecon (con_id,con_num,con_path) "
    + "  Values("+ maxidcon + ","+ maxid + pub.toSqlStr(adddoc[i],0) + ")";
    rec = query.exec(pub.decodeGB(sqlcon));
    } if (rec == 0){
    Msg=" 增加客户操作生效,客户信息已经加入数据库!";
    }
    }
    catch (Exception E){
    }
    if (rec < 0) 
    {
    Msg= "增加客户操作失败,请梢后再试!";
    }//文件操作开始
    String strTypePath = "C:/Program Files/Apache Tomcat 4.0/webapps/sgi/archive/" + archivetypename;
    String strNamePath = strTypePath + "/" + archive_name ;
    System.out.println(strTypePath);File typePath = new File(strTypePath);
    File namePath = new File(strNamePath);if(!typePath.exists()){
    typePath.mkdir();
    }
    else{
    System.out.println("这个路径已经存在!!!");
    }if(!namePath.exists()){
    namePath.mkdir();
    }
    else{
    System.out.println("这个文件已经存在!!!");
    }//文件操作结束String temp = "C:/Program Files/Apache Tomcat 4.0/webapps/sgi/tmp";
    File tFile = new File(temp);
    String[] list;
    list = tFile.list();
    File[] fileList = new File[list.length];
    for(int i=0; i<list.length;i++){
    fileList[i] = new File(temp + "/" + list[i]);
    }for(int i=0; i<list.length;i++){ pub.Copy(strNamePath ,list[i] , temp + "/" + list[i]);
    fileList[i].delete();//拷贝完成删除临时文件}response.sendRedirect("adddocument.jsp");%>