By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,741 Members | 2,033 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,741 IT Pros & Developers. It's quick & easy.

i want to Delete files from folder after Uploaded through C# code

P: 4
I have inserted wordpad files to some folder(C:\karthik) through file upload tool in .net.
Now i want fill those files name to dropdown list and i want delete that particular file which i have selected in dropdown list.
How can i do this in C# 2.0
please help me
Feb 6 '08 #1
Share this Question
Share on Google+
2 Replies


100+
P: 111
Hi

Import namespace System.IO;


string SPath = HttpContext.Current.Request.PhysicalApplicationPat h.ToString() + "Files\\a.aspx"; //Path where the file present.

File.Delete(SPath);
Feb 6 '08 #2

P: 4
gkn
Before Deleting the file it is good to check whether it exists or not

If (File.Exists(SPath)) File.Delete(SPath);
Feb 6 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.