using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Data; using System.Data.SqlClient; using System.Web; public partial class video1 : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } byte[] buffer; protected void Button1_Click(object sender, EventArgs e) { { String fileExtension = System.IO.Path.GetExtension(FileUpload1.FileName).ToLower(); byte[] MediaBytes = new byte[FileUpload1.PostedFile.InputStream.Length]; if (FileUpload1.HasFile && FileUpload1.PostedFile != null && FileUpload1.PostedFile.FileName != "") { HttpPostedFile file = FileUpload1.PostedFile; buffer = new byte[file.ContentLength]; int bytesReaded = file.InputStream.Read(buffer, 0, FileUpload1.PostedFile.ContentLength); if (bytesReaded > 0) { try { SqlConnection conn = new SqlConnection(); conn.ConnectionString = "Data Source=DEEPAK-PC\\SQLEXPRESS;Initial Catalog=NewCrackers;User ID=sa;Password=sasa"; conn.Open(); SqlCommand cmd = new SqlCommand ("INSERT INTO Videos (Video, Video_Name, Video_Size) VALUES (@video, @videoName, @videoSize)", conn); cmd.Parameters.Add("@video", SqlDbType.VarBinary, buffer.Length).Value = buffer; cmd.Parameters.Add("@videoName", SqlDbType.NVarChar).Value = FileUpload1.FileName; cmd.Parameters.Add("@videoSize", SqlDbType.BigInt).Value = file.ContentLength; using (conn) { cmd.ExecuteNonQuery(); Label1.Text = " uploaded "; conn.Close(); } } catch (Exception ex) { Label1.Text = ex.Message.ToString(); } } } else { Label1.Text = "Choose a valid video file"; } } } }
Flash1.MovieURL = "Path ";
MediaPlayer1.MediaSource = "Path ";
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)