elseif strcomp(leftb(strtemp,6),chrb(71) & chrb(73) & chrb(70) & chrb(56) & chrb(57) & chrb(97),0)=0 or strcomp(leftb(strtemp,6),chrb(71) & chrb(73) & chrb(70) & chrb(56) & chrb(55) & chrb(97),0)=0 then
if lcase(strfext)<>"gif" then strfext="gif"
binitem.position=6
objform.add strinam&"_width",binval2(binitem.read(2))
objform.add strinam&"_height",binval2(binitem.read(2))
elseif strcomp(leftb(strtemp,2),chrb(66) & chrb(77),0)=0 then
if lcase(strfext)<>"bmp" then strfext="bmp"
binitem.position=18
objform.add strinam&"_width",binval2(binitem.read(4))
objform.add strinam&"_height",binval2(binitem.read(4))
end if
end if
objform.add strinam&"_ext",strfext
objform.add strinam&"_from",p_start
inttemp=getferr(lngfsiz,strfext)
if p_autosave<>2 then
objform.add strinam&"_err",inttemp
if inttemp=0 then
if p_autosave=0 then
strfnam=gettimestr()
if strfext<>"" then strfnam=strfnam&"."&strfext
end if
binitem.savetofile server.mappath(p_savepath&strfnam),2
objform.add strinam,strfnam
end if
end if
else
objform.add strinam&"_err",-1
end if
end if
else
binitem.position=0
binitem.type=2
binitem.charset="gb2312"
strtemp=binitem.readtext
if objform.exists(strinam) then
objform(strinam) = objform(strinam)&","&strtemp
else
strformitem=strformitem&strsplit&strinam
objform.add strinam,strtemp
end if
end if
binitem.close()
p_start = p_end+intseparator+2
loop until p_start+3>lngrequestsize
formitem=split(strformitem,strsplit)
fileitem=split(strfileitem,strsplit)
end sub
private function gettimestr()
lngtime=lngtime+1
gettimestr=strdate&lngtime
end function
private function getferr(lngfsiz,strfext)
dim intferr
intferr=0
if lngfsiz>p_maxsize and p_maxsize>0 then
if p_error=0 or p_error=2 then p_error=p_error+1
intferr=intferr+1
end if
if instr(1,lcase("/"&p_filetype&"/"),lcase("/"&strfext&"/"))=0 and p_filetype<>"" then
if p_error<2 then p_error=p_error+2
intferr=intferr+2
end if
getferr=intferr
end function
public function save(item,strfnam)
save=false
if objform.exists(item&"_from") then
dim intferr,strfext
strfext=objform(item&"_ext")
intferr=getferr(objform(item&"_size"),strfext)
if objform.exists(item&"_err") then
if intferr=0 then
objform(item&"_err")=0
end if