rename files to upload to server ASP.NET

Total Post:135


 1378  View(s)
Rate this:

I need to rename the files before uploading them to my local directory.

How I can do this this?

  1. Re: rename files to upload to server ASP.NET

    Hi Chintoo, 

    try this:

     protected void button1_Click(object sender, EventArgs e){

        string directory = Server.MapPath("uploads");

        string fExtension = Path.GetExtension(FileUpload1.PostedFile.FileName);

        string fileName = "newFileName" + fExtension;



    Hope this will solve your problem


Please check, If you want to make this post sponsored

You are not a Sponsored Member. Click Here to Subscribe the Membership.