Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You can check out the following link</p> <p><a href="http://asp-net-example.blogspot.in/2009/01/aspnet-fileupload-example-how-to-rename.html" rel="noreferrer">http://asp-net-example.blogspot.in/2009/01/aspnet-fileupload-example-how-to-rename.html</a></p> <pre><code>&lt;%@ Page Language="C#" %&gt; &lt;%@ Import Namespace="System.IO" %&gt; &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;script runat="server"&gt; protected void Button1_Click(object sender, System.EventArgs e) { string uploadFolder = Request.PhysicalApplicationPath + "UploadFile\\"; if (FileUpload1.HasFile) { string extension = Path.GetExtension(FileUpload1.PostedFile.FileName); FileUpload1.SaveAs(uploadFolder + "Test"+ extension); Label1.Text = "File uploaded successfully as: " + "Test"+ extension; } else { Label1.Text = "First select a file."; } } &lt;/script&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head id="Head1" runat="server"&gt; &lt;title&gt;asp.net FileUpload example: how to rename file when upload (change file name when upload)&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;form id="form1" runat="server"&gt; &lt;div&gt; &lt;h2 style="color:Green"&gt;asp.net FileUpload example: File Rename&lt;/h2&gt; &lt;asp:Label ID="Label1" runat="server" Font-Size="Large" ForeColor="OrangeRed" &gt; &lt;/asp:Label&gt; &lt;br /&gt;&lt;br /&gt; &lt;asp:FileUpload ID="FileUpload1" runat="server" BackColor="DeepPink" ForeColor="AliceBlue" /&gt; &lt;asp:Button ID="Button1" runat="server" Font-Bold="true" ForeColor="DeepPink" OnClick="Button1_Click" Text="Upload It" /&gt; &lt;/div&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload