1 If (this. fileupload. postedfile. contentlength! = 0) // first determine whether a file has been uploaded
String filename = This. fileupload. postedfile. filename. tostring (); // obtain the complete file name first.
System. Io. Path. getfilename (filename )! = "The relationship between the distributor and the dealer is locked. xls" // get the file name
String filenameext = system. Io. Path. getextension (filename). tostring (); // obtain the file extension.
If (filenameext. toupper (). Equals (". xls") | filenameext. toupper (). Equals (". CVs") // determines whether the file is an Excel file.
string strfilename = system. io. path. getfilename (strfile); // get the file name
string strfullfile = server. mappath (@".. /report/") + strfilename; // server absolute path and file name
If (system. io. file. exists (strfullfile) // if the file exists
{< br> system. io. file. delete (strfullfile); // Delete
}< br> fileupload. postedfile. saveas (strfullfile); // upload to this path