Introduction :
This code will help you understand how to use file upload control in asp.net and the code to upload the file on specific folder path.
Code:
string iim = DateTime.Now.ToString("ddMMyyyyHHmmss"); //prefis of file name to upload
if (FileUpload01.HasFile)
{
string f1 = Path.GetFileName(FileUpload01.PostedFile.FileName);
string[] xx = f1.Split('.'); // to get posted file extension
string a = iim + "_" + xx[1].ToString();
FileUpload01.SaveAs(Server.MapPath("~/FolderPath/") + a);
}
This code will help you understand how to use file upload control in asp.net and the code to upload the file on specific folder path.
Code:
string iim = DateTime.Now.ToString("ddMMyyyyHHmmss"); //prefis of file name to upload
if (FileUpload01.HasFile)
{
string f1 = Path.GetFileName(FileUpload01.PostedFile.FileName);
string[] xx = f1.Split('.'); // to get posted file extension
string a = iim + "_" + xx[1].ToString();
FileUpload01.SaveAs(Server.MapPath("~/FolderPath/") + a);
}
No comments:
Post a Comment