3 回答
TA贡献1788条经验 获得超4个赞
您可以在项目中使用SQL Server Compact 。它将嵌入到您的 Windows 窗体应用程序中,您可以将文件保存在二进制列中。
还可以考虑其他可能性:
将视频保存在程序子文件夹中的常规文件夹中(或用户文件夹中)
您可以使用嵌入式资源(如前面的答案中提到的)
使用Windows 支持的复合文件。
TA贡献1811条经验 获得超6个赞
在 C#.net 中使用 Fileupload Control 保存视频文件怎么样?我只给出建议。
try
{
UploadVideo obj = new UploadVideo();
string filename = fuUploadVideo.FileName;
string path = Server.MapPath("Uploads4");
string strFinalFileName = Path.GetFileName(fuUploadVideo.FileName);
long FileLength = fuUploadVideo.PostedFile.ContentLength;
long uploadchunklimit;
int SizeLimit = (int)FileLength;
if (FileLength <= 1024)
{
uploadchunklimit = 1;
SizeLimit = (int)FileLength;
}
else if (FileLength > 1024)
{
uploadchunklimit = FileLength / 1024;
SizeLimit = 10;
}
else if (FileLength <= 10240 && FileLength > 1024)
{
uploadchunklimit = FileLength / 1024;
}
else
{
uploadchunklimit = FileLength / 1024;
}
long lngSize = (long)SizeLimit;
lngSize = 1024 * 1024;
string ext = Path.GetExtension(fuUploadVideo.PostedFile.FileName);
fuUploadVideo.PostedFile.SaveAs(Server.MapPath("Uploads4\\" + filename));
path = "Uploads4\\" + filename;
SqlConnection con = new SqlConnection(str);
cmd = new SqlCommand("Insert into electronicmedia(Video_Name,url) values(@Video,'" + path + "')", con);
cmd.Parameters.AddWithValue("Video", TextBox2.Text);
cmd.CommandType = CommandType.Text;
con.Open();
cmd.ExecuteNonQuery();
con.Close();
lblinfo.Text = " uploaded successfully ";
}
catch (Exception ex)
{
Response.Write(ex.ToString());
}
- 3 回答
- 0 关注
- 146 浏览
添加回答
举报