Private string strgetface, PRIVATE STRGETFACE
{
get
{
String strresult = "";
IF (FaceUpload.PostedFile.ContentLength> 0)
{
/ / Set the save path for upload files
String strandir = "./face/";
String strname = faceupload.postedfile.filename;
// Obtain the index of the last "." In the file name (pose path).
INT INTEXT = STRNAME.lastIndexof (".");
// obtain the file extension
String strext = strname.substring (intelt);
// This automatically nams files depending on the date and file size, ensuring that the file name is not repeated.
Datetime datnow = datetime.now;
String strnewname = datnow.dayofyear.tostring () FaceUpload.postedFile.contentLength.toT7tring () strexT;
String intPath = strnavedir strnewname;
// Upload the type of file
IF (strext == ".jpg" || strext == ".gif")
{
/ / Save the file to the directory you want, here is the UPLOAD directory of the IIS root directory. You can change.
// Note: I use server.mappath () to take the absolute directory of the current file. In ASP.NET "/" must be replaced with "//"
FaceUpload.postedFile.saveas (Server.MAppath (STRSAVEDIR STRNEWNAME);
Strresult = intPath;
}
Else
{
Response.Redirect ("? Out = error & id = 601");
}
}
Else
{
IF (Faceurl.Text.toString ()! = "&& Facerl.Text.toString ()! = NULL)
Strresult = FaceURL.TEXT.TOSTRING (). TRIM ();
Else
Strresult = "face /" request.form ["faces"]. TOSTRING (). Trim ();
}
Return Strresult;
}
}