No component upload files (1)

Source: Internet
Author: User
Upload | no component file:upload.asp


<%
' Author Philippe Collignon
' Email PhCollignon@email.com

Sub Builduploadrequest (Requestbin)
' Get the boundary
Posbeg = 1
Posend = InstrB (posbeg,requestbin,getbytestring (Chr (13)))
Boundary = MidB (Requestbin,posbeg,posend-posbeg)
Boundarypos = InstrB (1,requestbin,boundary)
' Get all data inside the boundaries
Do Until (BOUNDARYPOS=INSTRB (Requestbin,boundary & Getbytestring ("--)")
' members variable of the objects are put in a Dictionary object
Dim Uploadcontrol
Set Uploadcontrol = CreateObject ("Scripting.Dictionary")
' Get ' object name
Pos = InstrB (boundarypos,requestbin,getbytestring ("Content-disposition"))
Pos = InstrB (pos,requestbin,getbytestring ("Name="))
Posbeg = pos+6
Posend = InstrB (posbeg,requestbin,getbytestring (Chr (34)))
Name = getString (MidB (Requestbin,posbeg,posend-posbeg))
Posfile = InstrB (boundarypos,requestbin,getbytestring ("Filename="))
Posbound = InstrB (posend,requestbin,boundary)
' Test if object is of file type
If posfile<>0 and (Posfile<posbound) Then
' Get Filename, Content-type and content of file
Posbeg = Posfile + 10
Posend = InstrB (posbeg,requestbin,getbytestring (Chr (34)))
FileName = getString (MidB (Requestbin,posbeg,posend-posbeg))
' Add filename to Dictionary object
Uploadcontrol.add "filename", filename
Pos = InstrB (posend,requestbin,getbytestring ("Content-type:"))
Posbeg = pos+14
Posend = InstrB (posbeg,requestbin,getbytestring (Chr (13)))
' Add Content-type to Dictionary object
ContentType = getString (MidB (Requestbin,posbeg,posend-posbeg))
Uploadcontrol.add "ContentType", ContentType
' Get content of object '
Posbeg = posend+4
Posend = InstrB (posbeg,requestbin,boundary)-2
Value = MidB (Requestbin,posbeg,posend-posbeg)
Else
' Get content of object '
Pos = InstrB (pos,requestbin,getbytestring (Chr (13)))
Posbeg = pos+4
Posend = InstrB (posbeg,requestbin,boundary)-2
Value = getString (MidB (Requestbin,posbeg,posend-posbeg))
End If
' Add content to Dictionary object
Uploadcontrol.add "Value", value
&nbs



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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.