欢迎光临
我们一直在努力

不用组件实现上载功能(英文NT)

建站超值云服务器,限时71元/月

—- file name /upaoad.asp/

<%

public function builduploadrequest(strrequestbin)

dim posbeg, posend, boundary, boundarypos

get the boundary

posbeg = 1

posend = instrb(posbeg,strrequestbin,getbytestring(chr(13)))

boundary = midb(strrequestbin,posbeg,posend-posbeg)

boundarypos = instrb(1,strrequestbin,boundary)

get all data inside the boundaries

do until (boundarypos = instrb(strrequestbin,boundary & getbytestring("–")))

members variable of objects are put in a dictionary object

dim uploadcontrol

set uploadcontrol = createobject("scripting.dictionary")

dim pos, name

get an object name

pos = instrb(boundarypos,strrequestbin,getbytestring("content-disposition"))

pos = instrb(pos,strrequestbin,getbytestring("name="))

posbeg = pos + len("name=") + 1

posend = instrb(posbeg,strrequestbin,getbytestring(chr(34)))

name = getstring(midb(strrequestbin,posbeg,posend-posbeg))

dim posfile, posbound, contenttype, value

test if object is of file type

posfile = instrb(boundarypos,strrequestbin,getbytestring("filename="))

posbound = instrb(posend,strrequestbin,boundary)

if posfile <> 0 and posfile < posbound then

get filepathname of the file

posbeg = posfile + len("filename=") + 1

posend = instrb(posbeg,strrequestbin,getbytestring(chr(34)))

filepathname = getstring(midb(strrequestbin,posbeg,posend-posbeg))

add filename(with path) to dictionary object

uploadcontrol.add "filepathname", filepathname

get content-type of the file

pos = instrb(posend,strrequestbin,getbytestring("content-type:"))

posbeg = pos + len("content-type:") + 1

posend = instrb(posbeg,strrequestbin,getbytestring(chr(13)))

contenttype = getstring(midb(strrequestbin,posbeg,posend-posbeg))

add content-type to dictionary object

uploadcontrol.add "contenttype",contenttype

get content of object

posbeg = posend + 4

posend = instrb(posbeg,strrequestbin,boundary)-2

value = midb(strrequestbin,posbeg,posend-posbeg)

else

get content of object

pos = instrb(pos,strrequestbin,getbytestring(chr(13)))

posbeg = pos + 4

posend = instrb(posbeg,strrequestbin,boundary)-2

value = getstring(midb(strrequestbin,posbeg,posend-posbeg))

end if

add content to dictionary object

uploadcontrol.add "value" , value

add dictionary object to main dictionary

set uploadrequest(name) = uploadcontrol

loop to next object

boundarypos = instrb(boundarypos+lenb(boundary),strrequestbin,boundary)

loop

end function

string to byte string conversion

public function getbytestring(strstring)

dim intcount

getbytestring = ""

for intcount = 1 to len(strstring)

getbytestring = getbytestring & chrb(ascb(mid(strstring,intcount,1)))

next

end function

byte string to string conversion

public function getstring(strstring)

dim intcount

getstring = ""

for intcount = 1 to lenb(strstring)

getstring = getstring & chr(ascb(midb(strstring,intcount,1)))

next

end function

%>

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » 不用组件实现上载功能(英文NT)
分享到: 更多 (0)