关于视频上传的问题 大虾帮忙
小弟想实现视频上传的一个功能具体代码如下:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Collections.Generic;
using Xiaoxiao.Upload;
using System.IO;
using Spaces;
using Spaces.Controls;
using Spaces.Video;
public partial class Admin_UploadVideo : AdminPage
{
protected void Page_Load(object sender, EventArgs e)
{
videoBtn.Click += new EventHandler(videoBtn_Click);
if (!IsPostBack)
{
InitData();
}
}
void InitData()
{
UploadHelper uploadHelper = new UploadHelper();
uploadHelper.RegisterProgressBar(videoBtn, false, 1024*1024*50, ".asx,.asf,.mov,.wmv,.avi,.mpeg,.mpg,.flv,.3gp,.mp4");
}
void videoBtn_Click(object sender, EventArgs e)
{
Video v = new Video();
v.SourceType = (SourceType)int.Parse(rbtnSource.SelectedValue);
v.ServerID = VideoConfig.GetVideoConfig().DefaultServer.ServerID;
v.Title = txtName.Text;
v.Tags = Utils.GetTags(txtTags.Text);
v.Content = txtDesc.Text;
v.Account = this.Account;
UploadFile uploadFile = UploadHelper.GetUploadFile("file1");
if (uploadFile == null)
{
Message = "错误的格式";
return;
}
v.Extension = Path.GetExtension(uploadFile.FileName);
string savePath=Server.MapPath(string.Format("{0}/video/temp",Globals.ApplicationPath));
string saveName = string.Format("{0}{1}{2}", this.Account,DateTime.Now.ToFileTime(),v.Extension);
if (!CheckExt(v.Extension))//检查后缀名
{
Message = "您所上传的格式不支持";
return;
}
v.InputFile = Path.Combine(savePath,saveName);
uploadFile.SaveAs(v.InputFile);
Videos.CreateVideo(v);
Response.Redirect("myVideo.aspx");
}
bool CheckExt(string ext)
{
bool chk = false;
switch (ext.ToLower())
{
case ".wmv":
chk = true;
break;
case ".mp4":
chk = true;
break;
case ".3gp":
chk = true;
break;
case ".avi":
chk = true;
break;
case ".flv":
chk = true;
break;
case ".mpg":
chk = true;
break;
case ".mpeg":
chk = true;
break;
case ".asf":
chk = true;
break;
case ".mov":
chk = true;
break;
case ".asx":
chk = true;
break;
}
return chk;
}
}
出错页面如下:
“/”应用程序中的服务器错误。
--------------------------------------------------------------------------------
系统找不到指定的文件。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。
异常详细信息: System.ComponentModel.Win32Exception: 系统找不到指定的文件。
源错误:
行 65: uploadFile.SaveAs(v.InputFile);
行 66:
行 67: Videos.CreateVideo(v);
行 68:
行 69: Response.Redirect("myVideo.aspx");
源文件: e:\web sites\BLOG SYSTEM\qiupengfeng-blog\Admin\UploadVideo.aspx.cs 行: 67
堆栈跟踪:
[Win32Exception (0x80004005): 系统找不到指定的文件。]
System.Diagnostics.Process.StartWithShellExecuteEx(ProcessStartInfo startInfo) +976
System.Diagnostics.Process.Start() +127
System.Diagnostics.Process.Start(ProcessStartInfo startInfo) +50
Spaces.Video.FFMpeg.MakePic() +102
Spaces.Video.Videos.CreateVideo(Video v) +372
Admin_UploadVideo.videoBtn_Click(Object sender, EventArgs e) in e:\web sites\BLOG SYSTEM\qiupengfeng-blog\Admin\UploadVideo.aspx.cs:67
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +107
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1746
--------------------------------------------------------------------------------
版本信息: Microsoft .NET Framework 版本:2.0.50727.1433; ASP.NET 版本:2.0.50727.1433
各位帮忙看下 谢了 --------------------编程问答-------------------- 定下 --------------------编程问答-------------------- 关注
补充:.NET技术 , ASP.NET