How to upload file in asp.net

Hello Guys !
                           you want to upload file in your web application. just drag the uploadfile control from your toolbox. then drop in your web design page.
Take a Button from your toolbox and drop it in your design page . 


    

protected void Button1_Click(object sender, EventArgs e)
    {
        if (FileUpload1.HasFile)
        {
//if you want to save that particular file in your system anywhere then just give a path where you want to save your file.
            FileUpload1.SaveAs("c:\\newfolder\\" + FileUpload1.FileName);
            Label1.Text = "recieved" + FileUpload1.FileName + "content type" + FileUpload1.PostedFile.ContentType + "length" + FileUpload1.PostedFile.ContentType;

        }
        else {
            Label1.Text = "no file uploaded";
        }
    }

Comments

Popular posts from this blog

i am writing With sad hearts some problems with my windows phone samsung omnia w

Delete Duplicate Records in DataBase sql server