语音上传(三)

类别:Asp 点击:0 评论:0 推荐:

wav.asp  '读取数据

<%@ Language=VBScript %>
<% session.timeout=25%>
<%
   set conn=server.CreateObject("adodb.connection")
   connstr="Provider=sqloledb.1;Persist Security Info=False;User ID=sa;Initial Catalog=database;Data source=127.0.0.1;pwd="
   conn.open connstr

if err.number<>0 or err then
 err.clear
 response.write Err.Description
 response.end
 %>
 <script language="javascript">
  alert("网络现在繁忙,数据库连接发生错误,请等待几分钟再访问。")
 </script>
<%end if%>

<%
     dim RS,id
     set RS=Server.CreateObject("ADODB.Recordset")
     SQL="select wav from sound where id='"&request("id")&"'"
     RS.open SQL,conn,1,1
     Response.ContentType = "audio/x-wav"
     Response.BinaryWrite RS("wav").getChunk(7500000)
     'RS.close 
     'set RS=nothing
     conn.close
     set conn=nothing
%>

play.asp  '试听

<!--<embed src="wav.asp?ID=6%>" AUTOSTART="true" LOOP="TRUE" HEIGHT="45" WIDTH="320" VOLUME="100"><br>-->
                    <!-- Set ShowControls, ShowDisplay, ShowStatusBar 的值设定为 0,则不会显示在视频窗口下相对应的事物 -->
<OBJECT ID="NSPlay" WIDTH=300 HEIGHT=145 classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" standby="加载 Microsoft Windows Media Player 组件..." type="application/x-oleobject">
    <PARAM NAME="FileName" VALUE="wav.asp?id=<%=request("id")%>">
    <PARAM NAME="ShowControls" VALUE="1">
    <PARAM NAME="ShowDisplay" VALUE="1">
    <PARAM NAME="ShowStatusBar" VALUE="1">
    <PARAM NAME="AutoSize" VALUE="1">
    <embed src="wav.asp?uid=<%=request("id")%>"  width="320" height="125" type="application/x-mplayer2" pluginspage="http://www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/" filename="husteradio.asx" Name="NSPlay" ShowControls="1" ShowDisplay="1" ShowStatusBar="0">
</OBJECT>

本文地址:http://com.8s8s.com/it/it8751.htm