问题描述
小弟想实现视频上传的一个功能具体代码如下:usingSystem;usingSystem.Data;usingSystem.Configuration;usingSystem.Collections;usingSystem.Web;usingSystem.Web.Security;usingSystem.Web.UI;usingSystem.Web.UI.WebControls;usingSystem.Web.UI.WebControls.WebParts;usingSystem.Web.UI.HtmlControls;usingSystem.Collections.Generic;usingXiaoxiao.Upload;usingSystem.IO;usingSpaces;usingSpaces.Controls;usingSpaces.Video;publicpartialclassAdmin_UploadVideo:AdminPage{protectedvoidPage_Load(objectsender,EventArgse){videoBtn.Click+=newEventHandler(videoBtn_Click);if(!IsPostBack){InitData();}}voidInitData(){UploadHelperuploadHelper=newUploadHelper();uploadHelper.RegisterProgressBar(videoBtn,false,1024*1024*50,".asx,.asf,.mov,.wmv,.avi,.mpeg,.mpg,.flv,.3gp,.mp4");}voidvideoBtn_Click(objectsender,EventArgse){Videov=newVideo();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;UploadFileuploadFile=UploadHelper.GetUploadFile("file1");if(uploadFile==null){Message="错误的格式";return;}v.Extension=Path.GetExtension(uploadFile.FileName);stringsavePath=Server.MapPath(string.Format("{0}/video/temp",Globals.ApplicationPath));stringsaveName=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");}boolCheckExt(stringext){boolchk=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;}returnchk;}}出错页面如下:“/”应用程序中的服务器错误。--------------------------------------------------------------------------------系统找不到指定的文件。说明:执行当前Web请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。异常详细信息:System.ComponentModel.Win32Exception:系统找不到指定的文件。源错误:行65:uploadFile.SaveAs(v.InputFile);行66:行67:Videos.CreateVideo(v);行68:行69:Response.Redirect("myVideo.aspx");源文件:e:websitesBLOGSYSTEMqiupengfeng-blogAdminUploadVideo.aspx.cs行:67堆栈跟踪:[Win32Exception(0x80004005):系统找不到指定的文件。]System.Diagnostics.Process.StartWithShellExecuteEx(ProcessStartInfostartInfo)+976System.Diagnostics.Process.Start()+127System.Diagnostics.Process.Start(ProcessStartInfostartInfo)+50Spaces.Video.FFMpeg.MakePic()+102Spaces.Video.Videos.CreateVideo(Videov)+372Admin_UploadVideo.videoBtn_Click(Objectsender,EventArgse)ine:websitesBLOGSYSTEMqiupengfeng-blogAdminUploadVideo.aspx.cs:67System.Web.UI.WebControls.Button.OnClick(EventArgse)+105System.Web.UI.WebControls.Button.RaisePostBackEvent(StringeventArgument)+107System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(StringeventArgument)+7System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandlersourceControl,StringeventArgument)+11System.Web.UI.Page.RaisePostBackEvent(NameValueCollectionpostData)+33System.Web.UI.Page.ProcessRequestMain(BooleanincludeStagesBeforeAsyncPoint,BooleanincludeStagesAfterAsyncPoint)+1746--------------------------------------------------------------------------------版本信息:Microsoft.NETFramework版本:2.0.50727.1433;ASP.NET版本:2.0.50727.1433各位帮忙看下谢了
解决方案
解决方案二:
定下
解决方案三:
关注