Click here to Skip to main content
14,385,812 members
Rate this:
Please Sign up or sign in to vote.
See more:
Hi sir,
     Tell me the steps to  compress the video file and stored in db using asp.net c#. Kindly give me the solution for this problem.
Posted
Comments
Sibasisjena 8-Jan-14 3:30am
   
If you want to store the video file in your application then check my solution.
Rate this:
Please Sign up or sign in to vote.

Solution 1

If you want to store the video file in your application then go through the bellow link:

Video Uploader Control for SQL Server[^]
   
Rate this:
Please Sign up or sign in to vote.

Solution 2

Below is the code snippet ....
It will work...

using (BinaryReader br = new BinaryReader(FileUpload1.PostedFile.InputStream))
        {
            byte[] bytes = br.ReadBytes((int)FileUpload1.PostedFile.InputStream.Length);
            string strConnString = 'give the connection string';
            using (SqlConnection con = new SqlConnection(strConnString))
            {
                using (SqlCommand cmd = new SqlCommand())
                {
                    cmd.CommandText = "insert into tblFiles(Name, ContentType, Data) values (@Name, @ContentType, @Data)";
                    cmd.Parameters.AddWithValue("@Name", Path.GetFileName(FileUpload1.PostedFile.FileName));
                    cmd.Parameters.AddWithValue("@ContentType", "video/mp4");
                    cmd.Parameters.AddWithValue("@Data", bytes);
                    cmd.Connection = con;
                    con.Open();
                    cmd.ExecuteNonQuery();
                    con.Close();
                }
            }
        }


Let me know if it helps or not..
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100