语音上传(三)

网络整理 - 07-26
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"&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="#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="" filename="husteradio.asx" Name="NSPlay" ShowControls="1" ShowDisplay="1" ShowStatusBar="0">
</OBJECT>