This article illustrates the method of uploading and deleting asp.net picture files. Share to everyone for your reference, specific as follows:
Upload picture public
void Updataimage ()
{
//Get the selected file
string fileName = Fudimage.filename;
Gets the suffix name
string fileext = Path.getextension (fileName);
if (Fileext!= ". jpg")
{return
;
}
Get server-side-uploaded path
string serverpath = Server.MapPath ("/web/images");
Build Folder
String createdirectory = Serverpath + "\" + "card";
Fudimage.saveas (createdirectory + "\" + fileName);
}
Delete file public
void Delfile (string path)
{
System.IO.FileInfo file = new FileInfo (path);
if (file. Exists)
{
file. Delete ();
}
}
More interested in asp.net related content readers can view the site topics: "asp.net file Operation tips Summary", "asp.net string operation skills Summary", "ASP.net Operation XML Skills summary", "ASP.net Ajax Skills Summary topics" and " Summary of ASP.net caching operation techniques.
I hope this article will help you to ASP.net program design.