首先
UpFiles文件夾是要保存你上傳的文件
ImgFile文件夾是保存截取視頻文件的圖片
可叫做mencoder+ffmpeg視頻轉換
首先
CODE:
<appSettings>
<!
<add key=
<add key=
<add key=
<!
<add key=
<!
<add key=
<!
<add key=
<add key=
<add key=
<!
<add key=
</appSettings>
在上傳
CODE:
標題
<asp:RequiredFieldValidator ID=
ErrorMessage=
<br />
<asp:FileUpload ID=
<asp:Button ID=
文件類型<span >(
<asp:RegularExpressionValidator ID=
ValidationGroup=
ControlToValidate=
</asp:RegularExpressionValidator>
<asp:RequiredFieldValidator ID=
ErrorMessage=
<div ></div>
<div>上傳列表
程序工作的原理是
所以
這裡為了方便我是用sqlDatasource數據控件做數據的操作
CODE:
using System;
using System
using System
using System
using System
using System
using System
using System
using System
public partial class _Default : System
{
// 擴展名定義
string[] strArrFfmpeg = new string[] {
string[] strArrMencoder = new string[] {
protected void Page_Load(object sender
{
}
//
protected void btnUpload_Click(object sender
{
string upFileName =
if (this
{
string fileName = PublicMethod
if ((string)Session[
{
return;
}
upFileName = Server
this
string saveName = DateTime
string playFile = Server
string imgFile = Server
//System
PublicMethod pm = new PublicMethod();
string m_strExtension = PublicMethod
if (m_strExtension ==
{//直接拷貝到播放文件夾下
System
pm
}
string Extension = CheckExtension(m_strExtension);
if (Extension ==
{
pm
}
else if (Extension ==
{
pm
}
InsertData(this
Session[
}
}
//
private string CheckExtension(string extension)
{
string m_strReturn =
foreach (string var in this
{
if (var == extension)
{
m_strReturn =
}
}
if (m_strReturn ==
{
foreach (string var in strArrMencoder)
{
if (var == extension)
{
m_strReturn =
}
}
}
return
m_strReturn;
}
#region 插入數
據到數據庫中
private void InsertData(string MediaName
{
//string name=fileName
string imgName = saveName +
string playName = saveName +
string sqlstr =
//string constr = ConfigurationManager
SqlDataSource
SqlDataSource
SqlDataSource
SqlDataSource
SqlDataSource
SqlDataSource
SqlDataSource
}
#endregion
}
PublicMethod類如下
在這個類裡面主要是做文件轉換和保存
它的主要原理是另起一個進程在轉換的時候你會發現你的進程裡多了一個
using System;
using System
/// <summary>
/// Summary description for PublicMethod
/// </summary>
public class PublicMethod:System
{
public PublicMethod()
{
}
//文件路徑
public static string ffmpegtool = ConfigurationManager
public static string mencodertool = ConfigurationManager
public static string mplayertool = ConfigurationManager
public static string upFile = ConfigurationManager
public static string imgFile = ConfigurationManager
public static string playFile = ConfigurationManager
//文件圖片大小
public static string sizeOfImg = ConfigurationManager
//文件大小
public static string widthOfFile = ConfigurationManager
public static strin
From:http://tw.wingwit.com/Article/program/net/201311/12705.html