Friday 24 February 2017

code for upload files in folder using asp.net

Hi fiends....please follow the step by step procedure:
Hi friends this is Ravi Kumar, here i have given you the procedure and code to upload a file into a folder using asp.net. It is very easy please follow the process.
source code:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="uploads.aspx.cs" Inherits="uploads" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    
        <asp:FileUpload ID="FileUpload1" runat="server" />
        <br />
        <br />
        <br />
&nbsp;&nbsp;
        <asp:Button ID="Button1" runat="server" onclick="Button1_Click" 
            Text="fileupload" />
        <br />
        <br />
        <asp:Label ID="Label1" runat="server" Text="lblmessage"></asp:Label>
    
    </div>
    </form>
</body>
</html>

 design screen shot:






code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class uploads : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        FileUpload1.SaveAs(Server.MapPath("~/uploads/" + FileUpload1.FileName));
        Label1.Text = "file uploaded successfully";
    }

}

output screenshot:





Hi friends thanks for coming

If you have any doubts or problems please comment below ill definitely give you reply


Ravi Kumar
9505216182
Hyderabad
India.


To get more clarity please watch this video.


1 comment:

  1. hello Mr.Ravi Kumar, your vedios are very useful for us, can you please give me the code for how to print a datagrivew data while printing auotamatically it saves the datagridview data as pdf and print that datagridview,and one more dbt is how can we give the horizontal and vertical scroll bars in a datagridview. please give your vauluable answer. my email.id:akkirajulavanya@gmail.com


    Thanks & Regards in Advance.

    ReplyDelete