哈哈写了个新的二文件上传!才30行代码啊。很容易看懂……支持多文件。
'' upload.asp
Function IntMin(n,y)
If n<y and n>0 Then
IntMin=Int(n)
ElseIf y>0 Then
IntMin=Int(y)
Else
IntMin=n
End If
End Function
Function getFormValue(Name)
Dim formSize,formData,DataHeader,DataStart,DataEnd,formNameStart,formNameEnd,formName,firstFilter
formSize=Request.TotalBytes()
formData=Request.BinaryRead(formSize)
firstFilter=true
For i=1 to Len(Name)
tmp=tmp&ChrB(AscB(Mid(Name,i,1)))
Next
Name=tmp
DataEnd=0
DataStart=0
Do While formSize>0
formData=RightB(formData,formSize-DataEnd-DataStart+1)
formSize=formSize-DataEnd-DataStart+1
DataHeader=LeftB(formData,InStrB(formData,Chrb(13)&Chrb(10))-1)
DataStart=InStrB(formData,ChrB(13)&ChrB(10)&ChrB(13)&ChrB(10))+4
DataEnd=InStrB(DataStart+1,formData,DataHeader)-DataStart
If DataStart<0 or DataEnd<=0 Then Exit Do
filteredData=MidB(formData,DataStart,DataEnd-1)
formNameStart=InStrB(formData,ChrB(AscB("n"))&ChrB(AscB("a"))&ChrB(AscB("m"))&ChrB(AscB("e"))&ChrB(AscB("="))&ChrB(AscB("""")))+6
formNameEnd=intMin(InStrB(formNameStart,formData,ChrB(13)&ChrB(10))-formNameStart-1,InStrB(formNameStart,formData,ChrB(AscB(";")))-formNameStart-1)
formName=MidB(formData,formNameStart,formNameEnd)
If Name=formName Then
getFormValue=filteredData
Exit Function
End If
Loop
getFormValue=Name&" Not Found!"
End Function
Response.binaryWrite(getFormValue("loadfromfile"))''这个loadfromfile就是表单名啦~
%>
Tags:
作者:佚名评论内容只代表网友观点,与本站立场无关!
评论摘要(共 0 条,得分 0 分,平均 0 分)
查看完整评论