二文件上传,才30行代码
来源:网络 责任编辑:栏目编辑 发表时间:2013-07-01 23:53 点击:次
<%
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就是表单名啦~
%>
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就是表单名啦~
%>
相关新闻>>
最新推荐更多>>>
- 发表评论
-
- 最新评论 更多>>