protected void btnupload_Click(object sender, EventArgs e)
{
using (BinaryReader br = new BinaryReader(FileUpload1.PostedFile.InputStream))
{
}
What is the solution?
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Vincent Maverick DuranoPosted May 4, 2015, 6:06 PM
then make sure that your .ASPX page directive have something like this:
Tom MohanPosted Apr 7, 2015, 7:02 AM
Gowtham RajamanickamPosted Apr 7, 2015, 4:31 AM
Deepak RatanPosted Apr 7, 2015, 2:48 AM
Its showing ERROR in
ERROR 1:
"using (BinaryReader br = new BinaryReader(FileUpload1.PostedFile.InputStream))"
ERROR 2:
ERROR 1 The name 'FileUpload1' does not exist in the current context
ERROR 2 :The name 'DataList1' does not exist in the current context
Khargesh RajputPosted Apr 7, 2015, 2:18 AM
and add
video src dynamically on cs page
player1.Attributes.Add("src", vname);
here vname is path saved in database and file exist in your solution
I have implementd this on
http://economics.goyalsonline.com
Tom MohanPosted Apr 7, 2015, 2:12 AM
in aspx file
<%@ Page Title="About" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="About.aspx.cs" Inherits="WebApplication2.About" %>
in aspx.cs file.
namespace WebApplication2
{
public partial class About : Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnUpload_Click(object sender, EventArgs e)
{
using (BinaryReader br = new BinaryReader(FileUpload1.PostedFile.InputStream))
{
byte[] bytes = br.ReadBytes((int)FileUpload1.PostedFile.InputStream.Length);
string strConnString = ConfigurationManager.ConnectionStrings["constr"].ConnectionString;
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();
}
}
}
Response.Redirect(Request.Url.AbsoluteUri);
}
}
}
Deepak RatanPosted Apr 7, 2015, 1:52 AM
Thanks for giving link, in this we have to use database?
Khargesh RajputPosted Apr 7, 2015, 1:43 AM
this link is working for upload files
I have used video upload using this link
only change
'fileExt': '*.jpg;*.jpeg;*.gif;*.png',
to file extension here
.mp4
and to play video
<source src="movie.mp4" type="video/mp4">
</video>
Deepak RatanPosted Apr 7, 2015, 1:35 AM
No i am not using gridview
just i am following this link : http://www.aspsnippets.com/Articles/Upload-Save-Retrieve-and-Play-MP4-Video-files-with-live-streaming-from-Database-in-ASPNet-using-C-and-VBNet.aspx
bu its showing Fileupload1 ERROR
Do u have source code for uploading the video and play in ASP page
Deepak RatanPosted Apr 7, 2015, 1:32 AM
we have to use nested control for uploading the video?
I had tryed this link : http://www.aspsnippets.com/Articles/Upload-Save-Retrieve-and-Play-MP4-Video-files-with-live-streaming-from-Database-in-ASPNet-using-C-and-VBNet.aspx
but its showing error in Fileupload1 ERROR.
Do u have source code for uploading the video and play in ASP page
Khargesh RajputPosted Apr 7, 2015, 1:16 AM
Tom MohanPosted Apr 7, 2015, 1:14 AM
If you are using nested control. use findcontrol.
ex:
FileUpload file1 = (FileUpload)LoginView1.FindControl("FileUpload1");
refer
http://forums.asp.net/t/1027935.aspx?+The+name+FileUpload1+does+not+exist+in+the+current+context
http://stackoverflow.com/questions/7699108/the-name-xxx-does-not-exist-in-the-current-context
Deepak RatanPosted Apr 7, 2015, 1:02 AM
listviewvideo.aspx
Its there, For uploading the video i am using fileupload but the ID name its not working listviewvideo.aspx.cs
Khargesh RajputPosted Apr 7, 2015, 12:51 AM
FileUpload1 exist or not