本文介绍了从文件夹中删除图像时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
protected void LinkButtondelete_Command(object sender, CommandEventArgs e)
{
foreach(DataListItem item in DataListAttachfile.Items)
{
string vitualpath = System.Configuration.ConfigurationManager.AppSettings["UploadPath"].ToString() + DateTime.Now.Year.ToString() + "/" + DateTime.Now.Month.ToString() + "/" + DateTime.Now.Day.ToString() + "/" + att.Duongdanfile;
string savepath = HttpContext.Current.Server.MapPath("/" + vitualpath);
File.Delete(MapPath(vitualpath));
}
}
我的尝试:
What I have tried:
<asp:LinkButton ID="LinkButtondelete" runat="server" CommandArgument='<%# Eval("id") %>' CommandName="Select" CausesValidation="false"
OnCommand="LinkButtondelete_Command">Delete</asp:LinkButton>
推荐答案
这篇关于从文件夹中删除图像时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!