PosOpenBoundary = PosCloseBoundary PosCloseBoundary = InStrB(PosOpenBoundary + 1,FormData,DivStr) Wend Set GetUpload = Fields End Function
''把二进制字符串转换成普通字符串函数 Function bin2str(binstr) Dim varlen,clow,ccc,skipflag ''中文字符Skip标志 skipflag=0 ccc = "" If Not IsNull(binstr) Then varlen=LenB(binstr) For i=1 To varlen If skipflag=0 Then clow = MidB(binstr,i,1) ''判断是否中文的字符 If AscB(clow) > 127 Then ''AscW会把二进制的中文双字节字符高位和低位反转,所以要先把中文的高低位反转 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 End If bin2str = ccc End Function
''把普通字符串转成二进制字符串函数 Function str2bin(varstr) str2bin="" For i=1 To Len(varstr) varchar=mid(varstr,i,1) varasc = Asc(varchar) '' asc对中文字符求出来的值可能为负数, '' 加上65536就可求出它的无符号数值 '' -1在机器内是用补码表示的0xffff, '' 其无符号值为65535,65535=-1+65536 '' 其他负数依次类推。 If varasc<0 Then varasc = varasc + 65535 End If ''对中文的处理:把双字节低位和高位分开 If varasc>255 Then varlow = Left(Hex(Asc(varchar)),2) varhigh = right(Hex(Asc(varchar)),2) str2bin = str2bin & chrB("&H" & varlow) & chrB("&H" & varhigh) Else str2bin = str2bin & chrB(AscB(varchar)) End If Next End Function
''取得文件名(去掉Path) Function GetFileName(FullPath) If FullPath <> "" Then FullPath = StrReverse(FullPath) FullPath = Left(FullPath, InStr(1, FullPath, "/") - 1) GetFileName = StrReverse(FullPath) Else GetFileName = "" End If End Function </SCRIPT> <SCRIPT RUNAT=SERVER LANGUAGE=JSCRIPT> function CreateUploadField(){ return new uf_Init() } function uf_Init(){ this.Name = null this.FileName = null this.FilePath = null this.ContentType = null this.Value = null this.Length = null } </SCRIPT> <!----------------------------------------------------> 在提交的叶面使用 <form method="POST" enctype="multipart/form-data"> 保存的叶面 将upload.inc包含 <!--#include file="upload.inc"--> <%
function lngConvert2(strTemp) str1=leftb(strTemp,1) str2=rightb(strTemp,1) lngConvert2 = clng(ascb(str2) + ((ascb(str1) * 256))) end function
function lngConvert(strTemp) str1=leftb(strTemp,1) str2=rightb(strTemp,1) len1=ascb(str1) len2=ascb(str2) lngConvert = clng(ascb(str1) + ascb(str2) * 256) end function
Dim FormData,FormSize FormSize=Request.TotalBytes FormData=Request.BinaryRead(FormSize)
Set Fields = GetUpload(FormData) If Fields("newfile").FileName<>"" Then tempstr=Leftb(Fields("newfile").Value,10) tstr=chrb(255)&chrb(216)&chrb(255)&chrb(224)&chrb(0)&chrb(16)&chrb(74)&chrb(70)&chrb(73)&chrb(70) end if