相關(guān)資訊
- 《戰(zhàn)國(guó)無(wú)雙4-2》怎么換服裝?戰(zhàn)國(guó)無(wú)
- 關(guān)于責(zé)任的名言警句大全
- 《戰(zhàn)國(guó)無(wú)雙4-2》PC版如何聯(lián)機(jī)? 戰(zhàn)
- 戰(zhàn)國(guó)無(wú)雙4-2技能覺(jué)醒牛逼嗎 全新
- 《戰(zhàn)國(guó)無(wú)雙4-2》手柄無(wú)效怎么解決
- 戰(zhàn)國(guó)無(wú)雙4-2如何設(shè)置語(yǔ)言 戰(zhàn)國(guó)無(wú)雙
- 戰(zhàn)國(guó)無(wú)雙4-2怎么樣跳過(guò)進(jìn)入開場(chǎng)動(dòng)畫
- 什么是應(yīng)屆生畢業(yè)生
- 應(yīng)屆生簡(jiǎn)歷自我評(píng)價(jià)
- 應(yīng)屆生簡(jiǎn)歷怎么寫
本類常用軟件
-
福建農(nóng)村信用社手機(jī)銀行客戶端下載下載量:584204
-
Windows優(yōu)化大師下載量:416896
-
90美女秀(視頻聊天軟件)下載量:366961
-
廣西農(nóng)村信用社手機(jī)銀行客戶端下載下載量:365699
-
快播手機(jī)版下載量:325855
每日一囧
下面提供給大家分享的是asp實(shí)現(xiàn)語(yǔ)音上傳的實(shí)例代碼,希望能夠幫助到大家。
<script language="java script">
function openScript(url, width, height){
var Win = window.open(url,"openScript",'width=' + width + ',height=' + height + ',resizable=1,scrollbars=yes,menubar=no,status=yes' );
}
</script>
<form action="save.asp" method="POST" enctype="multipart/form-data">
<tr>
<td width="17%" height="66">選擇語(yǔ)音</td>
<td height="66" colspan="5">
<input type="file" name="wav" class="lan">
<input type="submit" name="Submit4" value="確定上傳" class="lan"> <input name="button" type="button" class="bu" value="有聲檔案" onClick="openScript('../play.asp?id=<%=session("id")%>','','scrollbars=no,resizable=no,width=340,height=200')"></td>
</tr>
</form>
表 sound 字段 id numeric 9 (自增) wav image 16 wavinfo varchar 50 wavsize numeric function openScript(url, width, height){
var Win = window.open(url,"openScript",'width=' + width + ',height=' + height + ',resizable=1,scrollbars=yes,menubar=no,status=yes' );
}
</script>
<form action="save.asp" method="POST" enctype="multipart/form-data">
<tr>
<td width="17%" height="66">選擇語(yǔ)音</td>
<td height="66" colspan="5">
<input type="file" name="wav" class="lan">
<input type="submit" name="Submit4" value="確定上傳" class="lan"> <input name="button" type="button" class="bu" value="有聲檔案" onClick="openScript('../play.asp?id=<%=session("id")%>','','scrollbars=no,resizable=no,width=340,height=200')"></td>
</tr>
</form>
save.asp '將聲音文件寫入數(shù)據(jù)庫(kù)
<%@ Language=VBScript %>
<!--#include file="../conn.asp"-->
<%
Response.expires=0
Server.ScriptTimeout =3600
call main()
sub main()
FormSize = Request.TotalBytes
FormData = Request.BinaryRead( FormSize )
bncrlf=chrb(13) & chrb(10)
divider=leftb(FormData,instrb(FormData,bncrlf)-1)
datastart=instrb(FormData,bncrlf & bncrlf)+4
dataend=instrb(datastart+1,formdata,divider)-datastart
Wav = WavUp(FormSize,Formdata)
strTXT=mid(formdata,instr(formdata,Wav)+len(Wav)+1)
strTXT=bin2str(strTXT)
'wavinfo=findVar("wavinfo",strTXT)
set RS=server.createobject("ADODB.recordset")
SQL="select wav,wavsize,wavinfo from sound"
RS.Open SQL,conn,1,3
RS.Addnew
RS("wavinfo")=wavinfo
RS("wavsize")=dataend-2
if Len(Wav)>1 then
RS("wav").Appendchunk Wav
end if
RS.Update
RS.Close
set RS=nothing
conn.close
set conn=nothing
'response.Write(Request.ServerVariables ("REMOTE_ADDR"))
response.Write("<script language='java script'>alert('語(yǔ)音上傳成功了,請(qǐng)返回!');window.location.reload('sound.asp');</script>")
response.end
end sub
Function bin2str(binstr)
Dim varlen,clow,ccc,skipflag
skipflag=0
ccc = ""
varlen=LenB(binstr)
For i=1 To varlen
If skipflag=0 Then
clow = MidB(binstr,i,1)
If AscB(clow) > 127 Then
ccc =ccc & Chr(AscW(MidB(binstr,i+1,1) & clow))
skipflag=1
Else
ccc = ccc & Chr(AscB(clow))
End If
Else
skipflag=0
End If
Next
bin2str = ccc
End Function
Function WavUp(formsize,formdata)
bncrlf=chrb(13) & chrb(10)
divider=leftb(formdata,instrb(formdata,bncrlf)-1)
datastart=instrb(formdata,bncrlf & bncrlf)+4
dataend=instrb(datastart+1,formdata,divider)-datastart
WavUp=midb(formdata,datastart,dataend)
End Function
Function findVar(varName,strTxt)
startPos=1
strLen=len(varName)+2
for i=1 to len(strTXT)
varStart=instr(startPos,strTXT,varName)+strLen+3
varEnd=instr(varStart,strTXT,"--")-2
varValLen=varEnd-varStart
inVar=mid(strTXT,varStart,varValLen)
findVar=findVar & inVar
startPos=instr(varStart,strTXT,varName)
if startPos=0 then exit for
findVar=findVar & ","
next
End function
%>
<!--#include file="../conn.asp"-->
<%
Response.expires=0
Server.ScriptTimeout =3600
call main()
sub main()
FormSize = Request.TotalBytes
FormData = Request.BinaryRead( FormSize )
bncrlf=chrb(13) & chrb(10)
divider=leftb(FormData,instrb(FormData,bncrlf)-1)
datastart=instrb(FormData,bncrlf & bncrlf)+4
dataend=instrb(datastart+1,formdata,divider)-datastart
Wav = WavUp(FormSize,Formdata)
strTXT=mid(formdata,instr(formdata,Wav)+len(Wav)+1)
strTXT=bin2str(strTXT)
'wavinfo=findVar("wavinfo",strTXT)
set RS=server.createobject("ADODB.recordset")
SQL="select wav,wavsize,wavinfo from sound"
RS.Open SQL,conn,1,3
RS.Addnew
RS("wavinfo")=wavinfo
RS("wavsize")=dataend-2
if Len(Wav)>1 then
RS("wav").Appendchunk Wav
end if
RS.Update
RS.Close
set RS=nothing
conn.close
set conn=nothing
'response.Write(Request.ServerVariables ("REMOTE_ADDR"))
response.Write("<script language='java script'>alert('語(yǔ)音上傳成功了,請(qǐng)返回!');window.location.reload('sound.asp');</script>")
response.end
end sub
Function bin2str(binstr)
Dim varlen,clow,ccc,skipflag
skipflag=0
ccc = ""
varlen=LenB(binstr)
For i=1 To varlen
If skipflag=0 Then
clow = MidB(binstr,i,1)
If AscB(clow) > 127 Then
ccc =ccc & Chr(AscW(MidB(binstr,i+1,1) & clow))
skipflag=1
Else
ccc = ccc & Chr(AscB(clow))
End If
Else
skipflag=0
End If
Next
bin2str = ccc
End Function
Function WavUp(formsize,formdata)
bncrlf=chrb(13) & chrb(10)
divider=leftb(formdata,instrb(formdata,bncrlf)-1)
datastart=instrb(formdata,bncrlf & bncrlf)+4
dataend=instrb(datastart+1,formdata,divider)-datastart
WavUp=midb(formdata,datastart,dataend)
End Function
Function findVar(varName,strTxt)
startPos=1
strLen=len(varName)+2
for i=1 to len(strTXT)
varStart=instr(startPos,strTXT,varName)+strLen+3
varEnd=instr(varStart,strTXT,"--")-2
varValLen=varEnd-varStart
inVar=mid(strTXT,varStart,varValLen)
findVar=findVar & inVar
startPos=instr(varStart,strTXT,varName)
if startPos=0 then exit for
findVar=findVar & ","
next
End function
%>
wav.asp '讀取數(shù)據(jù)
<%@ 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="java script">
alert("網(wǎng)絡(luò)現(xiàn)在繁忙,數(shù)據(jù)庫(kù)連接發(fā)生錯(cuò)誤,請(qǐng)等待幾分鐘再訪問(wèn)。")
</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 '試聽 <% 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="java script">
alert("網(wǎng)絡(luò)現(xiàn)在繁忙,數(shù)據(jù)庫(kù)連接發(fā)生錯(cuò)誤,請(qǐng)等待幾分鐘再訪問(wèn)。")
</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
%>
<!--<embed src="wav.asp?ID=6%>" AUTOSTART="true" LOOP="TRUE" HEIGHT="45" WIDTH="320" VOLUME="100"><br>-->
<!-- Set ShowControls, ShowDisplay, ShowStatusBar 的值設(shè)定為 0,則不會(huì)顯示在視頻窗口下相對(duì)應(yīng)的事物 -->
<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>
<!-- Set ShowControls, ShowDisplay, ShowStatusBar 的值設(shè)定為 0,則不會(huì)顯示在視頻窗口下相對(duì)應(yīng)的事物 -->
<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>
熱門評(píng)論
最新評(píng)論