Ajay Raj

Ajay Raj

  • NA
  • 142
  • 105.4k

How to upload video on web site

May 5 2012 7:56 AM
Hi,
Sir I want to upload video upload on the ASP.NET  , Click on the submit Button then disconnect the web browser.
please resolve the problem.


protected void Button1_Click(object sender, EventArgs e)
    {
            if (FileUpload1.HasFile)
            {
                String fileName = FileUpload1.FileName;
                String fileExtension = Path.GetExtension(fileName).ToLower();
                if (fileExtension.Equals(".flv") || fileExtension.Equals(".wmv"))
                {
                    if (!File.Exists(Path.Combine(Server.MapPath("~/video/"), fileName)))
                    {
                        String fullFileName = Path.Combine(Server.MapPath("~/video/"), fileName);
                        FileUpload1.SaveAs(fullFileName);
                        lbl_v_msg.Text = "Uploaded Successfully......";
                    }
                    else
                    {
                        lbl_v_msg.Text = "That file already exists! You must delete the current version to add an updated version.";
                    }
                }
                else
                {
                    lbl_v_msg.Text = "Only .flv or .wmv files are allowed!";
                }
            }
            else
            {
                lbl_v_msg.Text = "Select a file to upload!";
            }
       }