|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
asp,你就只能等着微软给你解决,它不乐意你就只好悲催。而且asp跑在windows服务器上,windows服务器跟linux比起来简直弱爆了!上传表sound字段idnumeric9(自增)wavimage16wavinfovarchar50wavsizenumeric
save.asp将声响文件写进数据库
<%@Language=VBScript%>
<!--#includefile="../conn.asp"-->
<%
Response.expires=0
Server.ScriptTimeout=3600
callmain()
submain()
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)
setRS=server.createobject("ADODB.recordset")
SQL="selectwav,wavsize,wavinfofromsound"
RS.OpenSQL,conn,1,3
RS.Addnew
RS("wavinfo")=wavinfo
RS("wavsize")=dataend-2
ifLen(Wav)>1then
RS("wav").AppendchunkWav
endif
RS.Update
RS.Close
setRS=nothing
conn.close
setconn=nothing
response.Write(Request.ServerVariables("REMOTE_ADDR"))
response.Write("<scriptlanguage=javascript>alert(语音上传乐成了,请前往!);window.location.reload(sound.asp);</script>")
response.end
endsub
Functionbin2str(binstr)
Dimvarlen,clow,ccc,skipflag
skipflag=0
ccc=""
varlen=LenB(binstr)
Fori=1Tovarlen
Ifskipflag=0Then
clow=MidB(binstr,i,1)
IfAscB(clow)>127Then
ccc=ccc&Chr(AscW(MidB(binstr,i+1,1)&clow))
skipflag=1
Else
ccc=ccc&Chr(AscB(clow))
EndIf
Else
skipflag=0
EndIf
Next
bin2str=ccc
EndFunction
FunctionWavUp(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)
EndFunction
FunctionfindVar(varName,strTxt)
startPos=1
strLen=len(varName)+2
fori=1tolen(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)
ifstartPos=0thenexitfor
findVar=findVar&","
next
Endfunction
%>
</p>ActiveServerPage技术为应用开发商提供了基于脚本的直观、快速、高效的应用开发手段,极大地提高了开发的效果。在讨论ASP的安全性问题之前,让我们来看看ASP是怎么工作的。 |
|