I have 2 images inside a folder called Pics ..... Image1.jpg and Image2.jpg.
What code should I put inside my Submit button to just delete Image1.jpg located here "~ / Pics / Image1.jpg"
Any help would be great !!!
You need to use System.IO.File.Delete not System.IO.Delete
string path = "~/Pics/Image1.jpg"; System.IO.File.Delete(Server.MapPath(path))
Syntax:
System.IO.File.Delete(Server.MapPath("~/Pics/Image1.jpg"));
, -, () , .
Try the following:
String FileName = "Image1.jpg"; System.IO.File.Delete(Server.MapPath(("~/Pics/") + FileName));
I would try:
String FilePath; FilePath = Server.MapPath("~/Pics/Image1.jpg"); File.Delete(FilePath);
Source: https://habr.com/ru/post/1707500/More articles:IE7 modified scrollbars overlap content - javascript(jQuery) Scrolling event. I want to scroll the document to the specified point if the user scrolls the page - javascriptWeb service import problem - vb.netDjango managers - retrieving objects with a non-empty set of related objects - djangoUsing NET Generic List ToArray in a Wrapper COM call causes an access violation, am I missing something? - c #objective-c: how to convert int to NSString - objective-cDoes Python have properties? - pythonCalculating the number of comments / posts - sqlWhy does replication merge fail when setting the LOCK_ESCALATION table? - sql-servermysql order by choice - maybe? - mysqlAll Articles