Using system. IO;
String Path = @ "D: \ accountdaoru \";
If (directory. exists (PATH) = false)
{
Directory. createdirectory (PATH );
}
If (directory. exists (server. mappath (~ /Upimg/hufu) = false) // create a file folder {directory. createdirectory (server. mappath (~ /Upimg/hufu);} // directory. Delete (server. mappath (~ /Upimg/hufu), true); // delete folders and subdirectories in folders, and determine the existence of files if (file. exists (server. mappath (~ /Upimg/data.html) {response. Write (yes); // file} else {response. Write (NO); // file. Create (mappath (~ /Upimg/data.html); // create the file} string name = getfiles. filename; // get the name of the uploaded file string size = getfiles. postedfile. contentlength. tostring (); // obtain the size of the uploaded file string type = getfiles. postedfile. contenttype; // obtain the mimestring Postfix = Name of the uploaded file. substring (name. lastindexof (.) + 1); // obtain the suffix string ipath = server of the uploaded file. mappath (upimg) + \\+ name; // obtain the actual file path string fpath = server. mappath (upfile) + \\+ name; string dpath = upimg \ + name; // judge the virtual path showpic written to the database. visible = true; // activate showtext. visible = true; // activate // determine the file format if (name =) {response. write (<scriptalert ('upload file cannot be blank ') </script );} else {If (Postfix = JPG | Postfix = GIF | Postfix = BMP | Postfix = PNG) {getfiles. saveas (ipath); showpic. imageurl = dpath; showtext. TEXT = The Name Of The uploaded image is + name ++ file size: + size + kb ++ file type: + type ++ the actual storage path is + ipath ;} else {showpic. visible = false; // hide the image getfiles. saveas (fpath); // as it is not an image file, the folder showtext is converted to upfile. TEXT = the name of the uploaded file is + name ++ file size: + size + kb ++ file type: + type ++ the actual storage path is + fpath ;}