Upload without components (NT)

Source: Internet
Author: User
Tags chr
'---- File name/upaoad. asp/
Public Function BuildUploadRequest (strRequestBin)
Dim PosBeg, PosEnd, boundary, boundaryPos
'Get the boundary
PosBeg = 1
PosEnd = Consumer B (PosBeg, strRequestBin, getByteString (chr (13 )))
Boundary = MidB (strRequestBin, PosBeg, PosEnd-PosBeg)
BoundaryPos = random B (1, strRequestBin, boundary)
'Get all data inside the boundaries
Do until (boundaryPos = stringb (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 = bytes B (boundaryPos, strRequestBin, getByteString ("Content-Disposition "))
Pos = Sort B (Pos, strRequestBin, getByteString ("name = "))
PosBeg = Pos + Len ("name =") + 1
PosEnd = Consumer B (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 = bytes B (BoundaryPos, strRequestBin, getByteString ("filename = "))
PosBound = forward B (PosEnd, strRequestBin, boundary)
If PosFile <> 0 AND PosFile <PosBound Then
'Get FilePathName of the file
PosBeg = PosFile + Len ("filename =") + 1
PosEnd = Consumer B (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 = Consumer B (PosEnd, strRequestBin, getByteString ("Content-Type :"))
PosBeg = Pos + Len ("Content-Type:") + 1
PosEnd = Consumer B (PosBeg, strRequestBin, getByteString (chr (13 )))
ContentType = getString (MidB (strRequestBin, PosBeg, PosEnd-PosBeg ))
'Add content-type to dictionary object
Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.