Upload any File Using FileUpload Control ASP.Net

Greetings!!!!

Here Is a sample code to upload any file it may be zip rar jpg or nay using file upload control

code for cs file


using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.IO;

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

}
protected void Button1_Click(object sender, EventArgs e)
{
Response.Write("FileUpload1.FileName=" + FileUpload1.FileName);
Response.Write("
FileUpload1.PostedFile.ContentLength=" + FileUpload1.PostedFile.ContentLength);
Response.Write("
FileUpload1.PostedFile.ContentType=" + FileUpload1.PostedFile.ContentType);
Response.Write("
FileUpload1.PostedFile.FileName=" + FileUpload1.PostedFile.FileName);
FileUpload1.PostedFile.SaveAs(Request.PhysicalApplicationPath + "upload/" + FileUpload1.FileName);
}
}



please refer attachments for the aspx file


For any assistance please find attachments and feel free to contact me
--
Thanks and Regards
Meetu Choudhary


Attachments

  • file upload (21737-10416-File Upload.zip)
  • Comments

    Author: Venkat10 Oct 2008 Member Level: Silver   Points : 0

    Hi,
    Really nice one and i get the output.

    Thanks

    Author: Mrs. Meetu Choudhary Nanda10 Oct 2008 Member Level: Gold   Points : 1

    Venkat,

    Happy to help you...

    --
    Thanks and Regards
    Meetu Choudhary

    Author: dandan30 Dec 2008 Member Level: Bronze   Points : 0

    nice
    another great example here:

    http://www.mo8.co.il/WebControls.aspx

    Author: Pradeep Iyer30 Dec 2008 Member Level: Gold   Points : 1

    Hi Meetu,

    Really a great code.
    Helps a lot of beginners and others.

    Masters are always masters :)

    Thanks,
    Pradeep Y

    Author: Itumeleng Ramothata19 Jan 2010 Member Level: Bronze   Points : 1

    Hi Meetu,

    Definitely reduces the time I was going to spend coding it.

    Thanks,
    Itumeleng R

    Author: Rk12 Feb 2010 Member Level: Silver   Points : 0

    Hi Meetu,

    ThanQ very much


    Regards,
    RK



  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: