大家能给出asp.net 上传视频 在线观看的代码吗 客户需要上传视频 大小应该在几十或者上百兆 应该用组件上传 但是大部分都收费 有免费的能提供下吗?还有就是想知道下如何播放视频的代码只要回答有帮组就给分。。谢谢 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 普通的网页播放器代码不行吗我没有用过,但是我认为可以用看看这个http://www.knowsky.com/344719.html上传的问题看看这个,我自己懒得写http://hi.baidu.com/royjohnson/blog/item/1a112fce579c7f0693457e31.html主要是用分块读取 1去51ASPX有免费提供代码的。 2播放和普通的网站播放器一样.我用REPLAYER也没问题.稍微注意一下文件格式看是否支持. [code=C#] public string DvUrl; protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { string DvUrlS = "蜡笔小新mtv.wmv";// Server.MapPath(@"030429demo08.swf");// Request. // QueryString["FilePath"].ToString(); //Response.Write("<PARAM Name='FlashVars' Value='init=yes&check=true' />"); //Response.Write("<EMBED src='030429demo08.swf' FlashVars='init=yes&check=true'></EMBED></EMBED>"); // Response.Write(DvUrlS); SelPlay(DvUrlS,380, 320); } } protected void SelPlay(string strUrl, int strWidth, int StrHeight) { string isExt; if (strUrl != "") { int i = strUrl.LastIndexOf("."); isExt = strUrl.Substring(i + 1, strUrl.Length - i - 1); // Response.Write(strUrl); } else { Response.Write("<script>alert('所选择的影音文件不存在!');</script>"); return; } isExt = isExt.ToLower(); switch (isExt) { case "avi": case "wmv": case "asf": case "mov": Response.Write("<EMBED id=MediaPlayer src='" + strUrl + "' width='" + strWidth + "' height='" + StrHeight + "' loop='false' autostart='true'></EMBED>"); break; case "rm": case "ra": case "rmvb": case "ram": Response.Write("<OBJECT height='" + StrHeight + "' width='" + strWidth + "' classid=clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA>"); Response.Write("<PARAM NAME='_ExtentX' VALUE='12700'>"); Response.Write("<PARAM NAME='_ExtentY' VALUE='9525'>"); Response.Write("<PARAM NAME='AUTOSTART' VALUE='-1'>"); Response.Write("<PARAM NAME='SHUFFLE' VALUE='0'>"); Response.Write("<PARAM NAME='PREFETCH' VALUE='0'>"); Response.Write("<PARAM NAME='NOLABELS' VALUE='0'>"); Response.Write("<PARAM NAME='SRC' VALUE='" + strUrl + "'>"); Response.Write("<PARAM NAME='CONTROLS' VALUE='ImageWindow'>"); Response.Write("<PARAM NAME='CONSOLE' VALUE='Clip'>"); Response.Write("<PARAM NAME='LOOP' VALUE='0'>"); Response.Write("<PARAM NAME='NUMLOOP' VALUE='0'>"); Response.Write("<PARAM NAME='CENTER' VALUE='0'>"); Response.Write("<PARAM NAME='MAINTAINASPECT' VALUE='0'>"); Response.Write("<PARAM NAME='BACKGROUNDCOLOR' VALUE='#000000'>"); Response.Write("</OBJECT>"); Response.Write("<BR>"); Response.Write("<OBJECT height=32 width='" + strWidth + "' classid=clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA>"); Response.Write("<PARAM NAME='_ExtentX' VALUE='12700'>"); Response.Write("<PARAM NAME='_ExtentY' VALUE='847'>"); Response.Write("<PARAM NAME='AUTOSTART' VALUE='0'>"); Response.Write("<PARAM NAME='SHUFFLE' VALUE='0'>"); Response.Write("<PARAM NAME='PREFETCH' VALUE='0'>"); Response.Write("<PARAM NAME='NOLABELS' VALUE='0'>"); Response.Write("<PARAM NAME='CONTROLS' VALUE='ControlPanel,StatusBar'>"); Response.Write("<PARAM NAME='CONSOLE' VALUE='Clip'>"); Response.Write("<PARAM NAME='LOOP' VALUE='0'>"); Response.Write("<PARAM NAME='NUMLOOP' VALUE='0'>"); Response.Write("<PARAM NAME='CENTER' VALUE='0'>"); Response.Write("<PARAM NAME='MAINTAINASPECT' VALUE='0'>"); Response.Write("<PARAM NAME='BACKGROUNDCOLOR' VALUE='#000000'>"); Response.Write("</OBJECT>"); break; case "swf": Response.Write("<OBJECT height='" + strWidth + "' width='" + strWidth + ">"); Response.Write("<PARAM Name='FlashVars' Value='init=yes&check=true' />"); Response.Write("<EMBED src='"+strUrl+"' FlashVars='init=yes&check=true'></EMBED></EMBED>"); Response.Write("</OBJECT>"); break; case "flv": Response.Write("<OBJECT codeBase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,2,0' classid='clsid:27CDB6E-AE6D-11cf-96B8-444553540000' width='"+strWidth+"' height='"+StrHeight+"'> "); Response.Write("<PARAM NAME='movie' VALUE='" + strUrl + "'> "); Response.Write("<PARAM NAME='play' VALUE='false'> "); Response.Write("<PARAM NAME='quality' VALUE='high'> "); Response.Write("<embed src='" + strUrl + "' quality='high' pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash' width='"+strWidth+"' height='"+StrHeight+"'></embed> "); Response.Write("</OBJECT> "); break;code] 这个可以播放! case "mpg": Response.Write("<object classid='clsid:05589FA1-C356-11CE-BF01-00AA0055595A' id='ActiveMovie1' width='" + strWidth + "' height='" + StrHeight + "'>"); Response.Write("<param name='Appearance' value='0'>"); Response.Write("<param name='AutoStart' value='-1'>"); Response.Write("<param name='AllowChangeDisplayMode' value='-1'>"); Response.Write("<param name='AllowHideDisplay' value='0'>"); Response.Write("<param name='AllowHideControls' value='-1'>"); Response.Write("<param name='AutoRewind' value='-1'>"); Response.Write("<param name='Balance' value='0'>"); Response.Write("<param name='CurrentPosition' value='0'>"); Response.Write("<param name='DisplayBackColor' value='0'>"); Response.Write("<param name='DisplayForeColor' value='16777215'>"); Response.Write("<param name='DisplayMode' value='0'>"); Response.Write("<param name='Enabled' value='-1'>"); Response.Write("<param name='EnableContextMenu' value='-1'>"); Response.Write("<param name='EnablePositionControls' value='-1'>"); Response.Write("<param name='EnableSelectionControls' value='0'>"); Response.Write("<param name='EnableTracker' value='-1'>"); Response.Write("<param name='Filename' value='" + strUrl + "' valuetype='ref'>"); Response.Write("<param name='FullScreenMode' value='0'>"); Response.Write("<param name='MovieWindowSize' value='0'>"); Response.Write("<param name='PlayCount' value='1'>"); Response.Write("<param name='Rate' value='1'>"); Response.Write("<param name='SelectionStart' value='-1'>"); Response.Write("<param name='SelectionEnd' value='-1'>"); Response.Write("<param name='ShowControls' value='-1'>"); Response.Write("<param name='ShowDisplay' value='-1'>"); Response.Write("<param name='ShowPositionControls' value='0'>"); Response.Write("<param name='ShowTracker' value='-1'>"); Response.Write("<param name='Volume' value='-480'>"); Response.Write("</object>"); break; case "smi": Response.Write("<OBJECT id=RVOCX classid=clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA width='" + strWidth + "' height='" + StrHeight + "'>"); Response.Write("<param name='_ExtentX' value='6350'>"); Response.Write("<param name='_ExtentY' value='4763'>"); Response.Write("<param name='AUTOSTART' value='-1'>"); Response.Write("<param name='SHUFFLE' value='0'>"); Response.Write("<param name='PREFETCH' value='0'>"); Response.Write("<param name='NOLABELS' value='-1'>"); Response.Write("<param name='SRC' value='" + strUrl + "'>"); Response.Write("<param name='CONTROLS' value='ImageWindow'>"); Response.Write("<param name='CONSOLE' value='console1'>"); Response.Write("<param name='LOOP' value='0'>"); Response.Write("<param name='NUMLOOP' value='0'>"); Response.Write("<param name='CENTER' value='0'>"); Response.Write("<param name='MAINTAINASPECT' value='0'>"); Response.Write("<param name='BACKGROUNDCOLOR' value='#000000'>"); Response.Write("<embed src='" + strUrl + "' type='audio/x-pn-realaudio-plugin' console='Console1' controls='ImageWindow' height='" + StrHeight + "' width='" + strWidth + "' autostart='true'>"); Response.Write("</OBJECT>"); break; } }接着上面的 C# Winform 控件事件的终止问题 Message="尝试读取或写入受保护的内存。这通常指示其他内存已损坏。" c#写的windows服务在xp系统下正常但是安装到2003系统下启动服务后停一会就停止了 datagridview 取消编辑值的问题 数据库操作类 删除 一个关于文本框 数据绑定的 疑问 C# 正则表达式 获取字符的问题 有没有c#的高手,懂得关于数据库的 在VS开发环境里如何把LISTBOX里的选择值赋给一个变量? 正则表达式,从后向前匹配 枚举 quoted-printable的解码问题~是一个邮件的附件~
我没有用过,但是我认为可以用看看这个
http://www.knowsky.com/344719.html上传的问题看看这个,我自己懒得写
http://hi.baidu.com/royjohnson/blog/item/1a112fce579c7f0693457e31.html
主要是用分块读取
稍微注意一下文件格式看是否支持.
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
string DvUrlS = "蜡笔小新mtv.wmv";// Server.MapPath(@"030429demo08.swf");// Request.
// QueryString["FilePath"].ToString();
//Response.Write("<PARAM Name='FlashVars' Value='init=yes&check=true' />");
//Response.Write("<EMBED src='030429demo08.swf' FlashVars='init=yes&check=true'></EMBED></EMBED>");
// Response.Write(DvUrlS);
SelPlay(DvUrlS,380, 320); }
}
protected void SelPlay(string strUrl, int strWidth, int StrHeight)
{
string isExt;
if (strUrl != "")
{
int i = strUrl.LastIndexOf(".");
isExt = strUrl.Substring(i + 1, strUrl.Length - i - 1);
// Response.Write(strUrl);
}
else
{
Response.Write("<script>alert('所选择的影音文件不存在!');</script>");
return;
}
isExt = isExt.ToLower();
switch (isExt)
{
case "avi":
case "wmv":
case "asf":
case "mov":
Response.Write("<EMBED id=MediaPlayer src='" + strUrl + "' width='" + strWidth + "' height='" + StrHeight + "' loop='false' autostart='true'></EMBED>");
break;
case "rm":
case "ra":
case "rmvb":
case "ram":
Response.Write("<OBJECT height='" + StrHeight + "' width='" + strWidth + "' classid=clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA>");
Response.Write("<PARAM NAME='_ExtentX' VALUE='12700'>");
Response.Write("<PARAM NAME='_ExtentY' VALUE='9525'>");
Response.Write("<PARAM NAME='AUTOSTART' VALUE='-1'>");
Response.Write("<PARAM NAME='SHUFFLE' VALUE='0'>");
Response.Write("<PARAM NAME='PREFETCH' VALUE='0'>");
Response.Write("<PARAM NAME='NOLABELS' VALUE='0'>");
Response.Write("<PARAM NAME='SRC' VALUE='" + strUrl + "'>");
Response.Write("<PARAM NAME='CONTROLS' VALUE='ImageWindow'>");
Response.Write("<PARAM NAME='CONSOLE' VALUE='Clip'>");
Response.Write("<PARAM NAME='LOOP' VALUE='0'>");
Response.Write("<PARAM NAME='NUMLOOP' VALUE='0'>");
Response.Write("<PARAM NAME='CENTER' VALUE='0'>");
Response.Write("<PARAM NAME='MAINTAINASPECT' VALUE='0'>");
Response.Write("<PARAM NAME='BACKGROUNDCOLOR' VALUE='#000000'>");
Response.Write("</OBJECT>");
Response.Write("<BR>");
Response.Write("<OBJECT height=32 width='" + strWidth + "' classid=clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA>");
Response.Write("<PARAM NAME='_ExtentX' VALUE='12700'>");
Response.Write("<PARAM NAME='_ExtentY' VALUE='847'>");
Response.Write("<PARAM NAME='AUTOSTART' VALUE='0'>");
Response.Write("<PARAM NAME='SHUFFLE' VALUE='0'>");
Response.Write("<PARAM NAME='PREFETCH' VALUE='0'>");
Response.Write("<PARAM NAME='NOLABELS' VALUE='0'>");
Response.Write("<PARAM NAME='CONTROLS' VALUE='ControlPanel,StatusBar'>");
Response.Write("<PARAM NAME='CONSOLE' VALUE='Clip'>");
Response.Write("<PARAM NAME='LOOP' VALUE='0'>");
Response.Write("<PARAM NAME='NUMLOOP' VALUE='0'>");
Response.Write("<PARAM NAME='CENTER' VALUE='0'>");
Response.Write("<PARAM NAME='MAINTAINASPECT' VALUE='0'>");
Response.Write("<PARAM NAME='BACKGROUNDCOLOR' VALUE='#000000'>");
Response.Write("</OBJECT>");
break;
case "swf":
Response.Write("<OBJECT height='" + strWidth + "' width='" + strWidth + ">");
Response.Write("<PARAM Name='FlashVars' Value='init=yes&check=true' />");
Response.Write("<EMBED src='"+strUrl+"' FlashVars='init=yes&check=true'></EMBED></EMBED>");
Response.Write("</OBJECT>");
break;
case "flv":
Response.Write("<OBJECT codeBase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,2,0' classid='clsid:27CDB6E-AE6D-11cf-96B8-444553540000' width='"+strWidth+"' height='"+StrHeight+"'> ");
Response.Write("<PARAM NAME='movie' VALUE='" + strUrl + "'> ");
Response.Write("<PARAM NAME='play' VALUE='false'> ");
Response.Write("<PARAM NAME='quality' VALUE='high'> ");
Response.Write("<embed src='" + strUrl + "' quality='high' pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash' width='"+strWidth+"' height='"+StrHeight+"'></embed> ");
Response.Write("</OBJECT> ");
break;
code]
这个可以播放!
Response.Write("<object classid='clsid:05589FA1-C356-11CE-BF01-00AA0055595A' id='ActiveMovie1' width='" + strWidth + "' height='" + StrHeight + "'>");
Response.Write("<param name='Appearance' value='0'>");
Response.Write("<param name='AutoStart' value='-1'>");
Response.Write("<param name='AllowChangeDisplayMode' value='-1'>");
Response.Write("<param name='AllowHideDisplay' value='0'>");
Response.Write("<param name='AllowHideControls' value='-1'>");
Response.Write("<param name='AutoRewind' value='-1'>");
Response.Write("<param name='Balance' value='0'>");
Response.Write("<param name='CurrentPosition' value='0'>");
Response.Write("<param name='DisplayBackColor' value='0'>");
Response.Write("<param name='DisplayForeColor' value='16777215'>");
Response.Write("<param name='DisplayMode' value='0'>");
Response.Write("<param name='Enabled' value='-1'>");
Response.Write("<param name='EnableContextMenu' value='-1'>");
Response.Write("<param name='EnablePositionControls' value='-1'>");
Response.Write("<param name='EnableSelectionControls' value='0'>");
Response.Write("<param name='EnableTracker' value='-1'>");
Response.Write("<param name='Filename' value='" + strUrl + "' valuetype='ref'>");
Response.Write("<param name='FullScreenMode' value='0'>");
Response.Write("<param name='MovieWindowSize' value='0'>");
Response.Write("<param name='PlayCount' value='1'>");
Response.Write("<param name='Rate' value='1'>");
Response.Write("<param name='SelectionStart' value='-1'>");
Response.Write("<param name='SelectionEnd' value='-1'>");
Response.Write("<param name='ShowControls' value='-1'>");
Response.Write("<param name='ShowDisplay' value='-1'>");
Response.Write("<param name='ShowPositionControls' value='0'>");
Response.Write("<param name='ShowTracker' value='-1'>");
Response.Write("<param name='Volume' value='-480'>");
Response.Write("</object>");
break;
case "smi":
Response.Write("<OBJECT id=RVOCX classid=clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA width='" + strWidth + "' height='" + StrHeight + "'>");
Response.Write("<param name='_ExtentX' value='6350'>");
Response.Write("<param name='_ExtentY' value='4763'>");
Response.Write("<param name='AUTOSTART' value='-1'>");
Response.Write("<param name='SHUFFLE' value='0'>");
Response.Write("<param name='PREFETCH' value='0'>");
Response.Write("<param name='NOLABELS' value='-1'>");
Response.Write("<param name='SRC' value='" + strUrl + "'>");
Response.Write("<param name='CONTROLS' value='ImageWindow'>");
Response.Write("<param name='CONSOLE' value='console1'>");
Response.Write("<param name='LOOP' value='0'>");
Response.Write("<param name='NUMLOOP' value='0'>");
Response.Write("<param name='CENTER' value='0'>");
Response.Write("<param name='MAINTAINASPECT' value='0'>");
Response.Write("<param name='BACKGROUNDCOLOR' value='#000000'>");
Response.Write("<embed src='" + strUrl + "' type='audio/x-pn-realaudio-plugin' console='Console1' controls='ImageWindow' height='" + StrHeight + "' width='" + strWidth + "' autostart='true'>");
Response.Write("</OBJECT>");
break;
} }接着上面的