Skip to main content

Posts

Showing posts with the label File

How to upload a file on the server through upload control in asp.net

With ASP.NET upload a file on the server is very easy.With FileUpload control we can easily upload a file on the server.Following markup is required.   < form id ="form1" runat ="server" > < asp:FileUpload id ="FileUploadControl" runat ="server" /> < asp:Button runat ="server" id ="btnupload" text ="Upload" onclick =" btnupload _Click" /> < asp:Label runat ="server" id ="lblstatus" /> </ form > Here is the CodeBehind code required to handle upload a file on the server. protected void btnupload _Click( object sender, EventArgs e) { if (FileUploadControl.HasFile) { try { string filename = Path.GetFileName(FileUploadControl.FileName); FileUploadControl.SaveAs(Server.MapPath( " ~/ " ) + filename); lblstatus .Text = " Upload status: Fi...

C# Console Application

A Console Application Screen is look like this:     To Create Console Application open Visual studio and click File from the menu bar at the top.From the file menu select New Project. When you click on New Project Following window will be appear.                                                                                                  In Case of Visual Studio 2010 window will be look like this: When you click OK , a new Console Application Project will be created.Some Code should be displayed.    Above is the Program.cs File in the Solution Explorer.Here You can write code according t...