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='javascript'>alert('語音上傳成功了,請返回!');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
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 %>