Displaying Source Code(s)
|
|
upload sniplet
--------------------------------------------------------------------------------
Description : To parse the Multipart/form-data from Enctype
submission
'Call like this: methodpackage = upload.
' form("MP")
Public Sub OnStartPage(PassedScriptingContext As
ScriptingContext)
'When a user requests a Web page in an A
' SP application, the server calls the OnS
' tartPage method for all objects (except
' those with application scope) on that pa
' ge. 'This call occurs the first time the
' object is accessed by a script.
'You can use the OnStartPage method to u
' se the ScriptingContext class to retriev
' e pointers to the built-in objects. 'You
' r object can then use the built-in objec
' ts to access its collections, methods, a
' nd properties. 'Using OnStartPage and Sc
' riptingContext to retrieve and use built
' -in objects and their methods, instead o
' f passing built-in objects as parameters
' , makes your object 'easier to use in AS
' P scripts.
'***** create ASP OBJECTS
Set MyScriptingContext = PassedScriptingContext
Set MyRequest = MyScriptingContext.Request
Set MyResponse = MyScriptingContext.Response
End Sub
'***** end create
Public Function form(formValue)
'*****
'variables below
Dim varByteCount, begining, ending, methodpackage, formValue
Dim binArray() As Byte
Dim lngCount As Long
Dim lngTotalByteCount As Long
Dim strHeadData As String
'***** end variables
'*****
'count of binary data from the encoded f
' orm
varByteCount = MyRequest.TotalBytes
'***** end count
'*****
'insert binary data into the array
ReDim binArray(varByteCount)
binArray = MyRequest.BinaryRead(varByteCount)
'***** end insert
'*****
'parse data from the array into strHeadD
' ata
lngTotalByteCount = CLng(varByteCount)
For lngCount = 0 To lngTotalByteCount - 1
strHeadData = strHeadData & Chr(binArray(lngCount))
Next
'***** end parse
'*****
'parse for form data we are looking for
begining = InStr(strHeadData, formValue) + 4
ending = InStr(begining, strHeadData,
"-----------------------------") - 1
methodpackage = Mid(strHeadData, begin, ending - begining)
form = methodpackage
'***** end parse
End Function |
|
|