如何从asp.net存储和检索视频文件 [英] how to stored and retrived video files from asp.net
本文介绍了如何从asp.net存储和检索视频文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何从asp.net存储和检索视频文件,我需要一些示例代码.
how to stored and retrived video files from asp.net i need some sample code.
推荐答案
嗨
与所有文件类型相同.我们使用Fileupload控件将视频文件上传到网站.
在服务器端保存视频文件的示例代码是
Hi
Same as for all filetypes.We use Fileupload control for upload video files to website.
sample code for saving video file in server side is
string fileext = Path.GetExtension(fd.FileName);
if (fileext == ".avi" || fileext == ".3gp" || fileext == ".mp4" || fileext == ".swf")
{
fd.SaveAs(Server.MapPath("~/videofiles/") + fd.FileName);
}
这里fd是文件上传控制ID.
从服务器端检索视频文件的示例代码是
Here fd is fileupload control Id .
Sample code for retrieving video files from server side is
DirectoryInfo deinfo = new DirectoryInfo(Server.MapPath("~/videofiles/"));
FileInfo[] finfo;
finfo = deinfo.GetFiles();
foreach (FileInfo sdf in finfo)
{
if (sdf.Extension == ".avi" || sdf.Extension == ".3gp" || sdf.Extension == ".mp4" || sdf.Extension == ".swf")
{
//do whatever you want with video file
}
}
在这里您可以使用扩展名过滤视频文件
我希望你能理解这一点
最好的
here you can filter video files by using extension
I hope u''ll understand this
All the best
u可以保存视频文件的网址并在.net中创建一个播放器,然后在此播放器中打开视频.....
u can save url of video file and create a player in .net and open video in this player........
这篇关于如何从asp.net存储和检索视频文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文