This method is used to process the image name. It returns a string type and the returned path is to be stored in the database.
/// Used to process the image name. The event is used as the image name.
/// </Summary>
/// <Returns> </returns>
Private string upload ()
{
String strdate = datetime. Now. tostring ();
Strdate = strdate. Replace ("-","");
Strdate = strdate. Replace (":","");
Strdate = strdate. Replace ("","");
String strfilename = This. file1.postedfile. filename;
Int nlength = strfilename. Length-strfilename. lastindexof (".");
Strfilename = strdate + strfilename. substring (strfilename. lastindexof ("."), nlength); // obtain the file name
String strpath = server. mappath (".") + "\ upload \\";
This. file1.postedfile. saveas (strpath + strfilename); // upload a file
Return "upload/" + strfilename; // return the relative URL path of the image.
}