rename files to upload to server ASP.NET Anonymous User176621-Aug-2014I need to rename the files before uploading them to my local directory.How I can do this this?asp.netasp.net Updated on 21-Aug-2014
Sumit Kesarwani
21-Aug-2014protected void button1_Click(object sender, EventArgs e){
string directory = Server.MapPath("uploads");
string fExtension = Path.GetExtension(FileUpload1.PostedFile.FileName);
string fileName = "newFileName" + fExtension;
this.FileUpload1.SaveAs(Path.Combine(directory,fileName));
}
Hope this will solve your problem