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] + " <br/ >");
//}
//response.write("directorys count:" + directorys.length + "个 <br/ >--------- <br >");
string[] files = directory.getfiles(abssavepath + @"" + page.user.identity.name, "*");
outstring.append("<ul>");
for (int i = 0; i < files.length; i++)
{
if (path.getfilename(files[i]) != "thumbs.db")
{
outstring.append("<li><img src=/"common/" + path.getfilename(files[i]) + "/" style=/"width:100px;height:100px;/" /><br/><input type=/"checkbox/" value=/"common/" + path.getfilename(files[i]) + "/" name=/"picname/" onclick=/"getpicid();/" id=/"imgid" + i.tostring() + "/" /><label for=/"imgid" + i.tostring() + "/">" + path.getfilename(files[i]) + "</label></li>");
}
}
outstring.append("</ul>");
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()));
}
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!!
点击进行留言回复
网友评论