Go homepage(回首页)
Upload pictures (上传图片)
Write articles (发文字帖)

The author:(作者)归海一刀
published in(发表于) 2014/1/30 1:24:42
asp.net读取磁盘文件、删除_[Asp.Net教程]

asp.net读取磁盘文件、删除_[Asp.Net教程]











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 < Directorys.Length; i++)
//{
// Response.Write(Directorys[i] + "
");
//}
//Response.Write("Directorys count:" + Directorys.Length + "个
---------
");
string[] Files = Directory.GetFiles(absSavePath + @"" + Page.User.Identity.Name, "*");
outstring.Append("");
Response.Write(outstring.ToString());
}

//删除文件
string[] strpicname = Request["imgids"].Split(new char[] { ’,’ });
for (int i = 0; i < strpicname.Length; i++)
{
File.Delete(Server.MapPath(strpicname[i].ToString()));
}
//循环遍历复选框















If you have any requirements, please contact webmaster。(如果有什么要求,请联系站长)





QQ:154298438
QQ:417480759