TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Ankita Singh
NA
159
19k
delete image from folder as like database
Mar 10 2018 12:55 AM
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
string id = Request.QueryString["id"].ToString();
imgdltdata(id);
}
}
private void imgdltdata(string id)
{
string qry = "delete from appformtbl where id=" + id + "";
DirectoryInfo diInfo = new DirectoryInfo(Server.MapPath("~/Rimage/" + image1.FileName));
FileInfo[] files = diInfo.GetFiles();
for (int i = 0; i < files.Length; i++)
{
string filePath = Server.MapPath("~/Rimage/" + files[i].ToString());
if
(File.Exists(filePath))
{
File.Delete(filePath);
}
}
}
this is my code i wanna do that when delete image from database thn also delete from folder.... this code is working but problem is this its delete all image from folder i know problem is in for loop but dont knw how to correct it.... plz someone help me plzzzz...... thanking you....
Reply
Answers (
2
)
Add validation to check if the user has already made a loan?
i m not able to store and retrieve the data in sqlserver