Function GetFileName(strTxt)
bb = instr(1,strTXT,"filename=")
if bb > 1 then
PStart = bb + 10
PEnd = instr(PStart,strTXT,Chr(34))
GetFileName = mid(strTXT,PStart,PEnd - PStart)
if GetFileName <> empty then
Pos = instr(1,GetFileName,"\")
while Pos > 0
Pos1 = instr(Pos+1,GetFileName,"\")
if Pos1>Pos then
Pos=Pos1
else
Pos1=Pos
Pos=0
end if
wend
GetFileName = right(GetFileName,Len(GetFileName)-Pos1)
end if
end if
End function
Function Bin2Str(binstr)
ccc = ""
varlen = LenB(binstr)
For i=1 To varlen
clow = MidB(binstr,i,1)
If AscB(clow) > 127 and i<varLen Then
ccc =ccc & Chr(AscW(MidB(binstr,i+1,1) & clow))
i=i+1
Else
ccc = ccc & Chr(AscB(clow))
End If
Next
bin2str = ccc
End Function
Function GetTxt(fmField,strTxt)
bb = instr(1,strTXT,fmField) '如果找不到则退出循环
if bb > 1 then
strLen = len(fmField) + 2 '表单中可能有多个同名变量(用在有主表与明细表中的数据更新中)
PStart = bb + strLen + 3
PEnd = instr(PStart,strTXT,Chr(34)) - 2
GetTxt = mid(strTXT,PStart,PEnd - PStart)
end if
End function
Function GetFile(formsize,formdata)
bncrlf = chrb(13) & chrb(10)
divider = leftb(formdata,instrb(formdata,bncrlf)-1) 'formdata第一个bncrlf左边的数据
datastart = instrb(formdata,bncrlf & bncrlf)+4 '两个bncrlf右边的数据的起始位
dataend = instrb(datastart+1,formdata,divider)-datastart
GetFile = midb(formdata,datastart,dataend)
End Function
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
'---------------------------------------RETURN THE IMAGE FORMAT--------------------
function checkImageFormat(checkdata)
'"--return: A,B,C (A is image format; B is height pixels; C is width pixels; D is color depth)
flag=0 '"""""""0 is not jpg/gif/png image; 1 is jpg/gif/png
'-------------------------------------------------------check jpg----------------
if flag=0 then
tempstr=Leftb(checkdata,10)
tstr=chrb(255)&chrb(216)&chrb(255)&chrb(224)&chrb(0)&chrb(16)&chrb(74)&chrb(70)&chrb(73)&chrb(70)
if strcomp(tempstr,tstr,0)=0 then
msgstr01="jpg"
lngSize = len(checkdata)
flgFound = 0
msgstr02=","& i_height & "," & i_width &","& i_Depth
flag=2
else
flag=0
end if
end if
'"--------------------------------------------------check gif--------------------------------
if flag=0 then
tempstr=Leftb(checkdata,6)
tstr=chrb(71)&chrb(73)&chrb(70)&chrb(56)&chrb(57)&chrb(97)
tstr2=chrb(71)&chrb(73)&chrb(70)&chrb(56)&chrb(55)&chrb(97)
if strcomp(tempstr,tstr,0)=0 or strcomp(tempstr,tstr2)=0 then
msgstr03="gif"
'"---------------------------------------------------check png------------------------------
if flag=0 then
tempstr=Leftb(checkdata,4)
tstr=chrb(137)&chrb(80)&chrb(78)&chrb(71)
if strcomp(tempstr,tstr,0)=0 then
msgstr05="png"
select case ascb(right(i_Depth,1))
case 0
i_Depth = 2 ^ (asc(left(i_Depth, 1)))
gfxSpex = True
case 2
i_Depth = 2 ^ (asc(left(i_Depth, 1)) * 3)
gfxSpex = True
case 3
i_Depth = 2 ^ (asc(left(i_Depth, 1))) '"8
gfxSpex = True
case 4
i_Depth = 2 ^ (asc(left(i_Depth, 1)) * 2)
gfxSpex = True
case 6
i_Depth = 2 ^ (asc(left(i_Depth, 1)) * 4)
gfxSpex = True
case else
i_Depth = -1
end select
msgstr06=","& i_height & ","& i_width &","& i_Depth
flag=2
else
flag=0
end if
end if
if flag=0 then
msgstr07="no image"
end if
msgstr=msgstr01 & msgstr02 & msgstr03 & msgstr04 & msgstr05 & msgstr06 & msgstr07