首頁  >  文章  >  php教程  >  读取磁盘文件 删除

读取磁盘文件 删除

WBOY
WBOY原創
2016-06-06 20:01:34866瀏覽

protected void ReadFile() //读取文件夹,文件 { string savePath = @"common"; StringBuilder outstring = new StringBuilder(); string absSavePath = Server.MapPath(savePath); string[] Directorys = Directory.GetDirectories(absSavePath + @"/" + P

 

    protected void ReadFile()     //读取文件夹,文件

    {

        string savePath = @"common";

        StringBuilder outstring = new StringBuilder();

        string absSavePath = Server.MapPath(savePath);

 

        string[] Directorys = Directory.GetDirectories(absSavePath + @"/" + Page.User.Identity.Name);

        //for (int i = 0; i

        //{

        //    Response.Write(Directorys[i] + "
");

        //}

        //Response.Write("Directorys count:" + Directorys.Length + "个  
---------
");

        string[] Files = Directory.GetFiles(absSavePath + @"" + Page.User.Identity.Name, "*");

 

        outstring.Append("

    ");

     

            for (int i = 0; i

            {

                if (Path.GetFileName(Files[i]) != "Thumbs.db")

                {

                    outstring.Append("

  • 读取磁盘文件  删除
  • ");

                }

            }

            outstring.Append("

");

 

        Response.Write(outstring.ToString());

    }

 

 

//删除文件

 

        string[] strpicname = Request["imgids"].Split(new char[] { ',' });

        for (int i = 0; i

        {

            File.Delete(Server.MapPath(strpicname[i].ToString()));

        }

 

 

//循环遍历复选框

 

    var imgnum = document.getElementsByTagName("input");

    var imgids = "";

    function getpicid()

    {

        document.getElementById("hidimgid").value = "";

        for (var i=0;i读取磁盘文件  删除

        {

            if ( imgnum[i].type == "checkbox" && imgnum[i].name == "picname" && imgnum[i].checked)

            {

                imgids += imgids == "" ? imgnum[i].value : "," + imgnum[i].value;

            }

        }

        document.getElementById("hidimgid").value = imgids;

    }

    

 

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn