Click here to Skip to main content
15,922,419 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How can i rename picture before upload?
Posted
Comments
thatraja 2-Jan-14 3:52am    
Share the code in your question

HI
just try this one


C#
string filename = "yourname" + Path.GetFileName(fileupload.FileName);
fileupload.SaveAs(Server.MapPath("~/Foldername/") + filename);


this will append yourname with origional filename. you can apply your logic on this one.
 
Share this answer
 
C#
if (FileUpload1.HasFile)
           {
               str = MapPath("~/Uploads") + "\\" + System.DateTime.Now.ToString("yyyyMMddhhmmss") + FileUpload1.FileName;
               FileUpload1.PostedFile.SaveAs(str);

               str = "~/Uploads/" + System.DateTime.Now.ToString("yyyyMMddhhmmss") + FileUpload1.FileName;
           }



here i append timestamp along with file name , like this u can change filename
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900