“此网页不可用”当我上传视频 [英] "This webpage is not available" when i upload a video
本文介绍了“此网页不可用”当我上传视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我将视频上传到我的数据库时,出现以下massege
此网页不可用
这里是我的上传代码
When i upload a video to my database the following massege appear
This webpage is not available
here is my upload code
byte[] buffer;//this is the array of bytes which will hold the data (file)
SqlConnection connection;
protected void ButtonUpload_Click(object sender, EventArgs e)
{
//check the file
if (FileUpload1.HasFile && FileUpload1.PostedFile != null && FileUpload1.PostedFile.FileName != "")
{
HttpPostedFile file = FileUpload1.PostedFile;//retrieve the HttpPostedFile object
buffer = new byte[file.ContentLength];
int bytesReaded = file.InputStream.Read(buffer, 0, FileUpload1.PostedFile.ContentLength);
if (bytesReaded > 0)
{
try
{
string connectionString = ConfigurationManager.ConnectionStrings["ConnString"].ConnectionString;
connection = new SqlConnection(connectionString);
SqlCommand cmd = new SqlCommand
("INSERT INTO VIDEO (Video, Video_Name, Video_Size) VALUES (@video, @videoName, @videoSize)", connection);
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 (connection)
{
connection.Open();
int i = cmd.ExecuteNonQuery();
Label1.Text = "uploaded, " + i.ToString() + " rows affected";
}
}
catch (Exception ex)
{
Label1.Text = ex.Message.ToString();
}
}
}
else
{
Label1.Text = "Choose a valid video file";
}
}
推荐答案
尝试按照以下文章:
http://videoplayer.codeplex.com/ [ ^ ]
try to follow the below article:
http://videoplayer.codeplex.com/[^]
这篇关于“此网页不可用”当我上传视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文