Question : how to rename a file before saving it after uploading in c#

Hi Experts,
I am uploading files using asp.net fileupload control. I want to rename the files in a specific pattern before saving them after upload  as i dont want to overwrite any existing files or prompt user the file already exists. Any ideas
thanks

Answer : how to rename a file before saving it after uploading in c#

Normally I use global unique identifier to make sur the file I save has a unique name
1:
2:
3:
            String path = Path.Combine(MapPath("~/Folder"), Guid.NewGuid() + Path.GetExtension(FileUpload1.FileName));

            FileUpload1.SaveAs(path );
Random Solutions  
 
programming4us programming4us