Saving a recording via ASP
Posted: Sat Apr 28, 2007 1:53 pm
Good afternoon to all,
I realize that you are not in the business of answering ASP questions, but I am wondering if you have any code examples that you could provide that illustrate other ways of saving a recording via ASP. Attached below is the current code I am using to record and save. The problem is that the system will throw an error if I try to record more than 25 seconds, even if I push out the maxtime to 120 seconds. All I want to do is take the recording and save it to a .vox file on my server with as little latency as possible.
Thanks so much,
Mike C.
Current files and what they do:
1. process_record_start.xml - records the user input
2. process_record_savevox.xml - gets the user input and saves it to a file
3. saverecording.asp - contains BuildUploadRequest which is used by process_record_savevox.xml
process_record_start.xml
<?xml version="1.0"?>
<vxml version="2.1">
<meta name="speak_exceptions" content="true"/>
<!--#include file="clsXMLConstants.asp"-->
<!--#include file="clsXMLDatabase.asp"-->
<!--#include file="clsXMLSessionManager.asp"-->
<!--#include file="clsXMLUtilities.asp"-->
<!--#include file="clsXMLVariables.asp"-->
<%
GetSessionValues
strFileCount = cint(strFileCount) + 1
SaveSessionValues
%>
<form id="record">
<grammar>1|2|3|4|5|6|7|8|9|0|"*"|"#"</grammar>
<record name="recording" beep="true" dtmfterm="true" maxtime="120s" finalsilence="5s" type="audio/basic">
<prompt bargein="false">
<% if ( cint(strFileCount) <= 1 ) then
'Log the dictation
'stored procedure: sp_insert_phone_in_log_record
'tables: phone_log
set conDatabase = Server.CreateObject("ADODB.Connection")
conDatabase.Open strConnection
objXMLUtilities.SetDictationStarted2 "L", strUserID, strFolderNumber, strCallID, 0
conDatabase.Close
%>
<voice>Record at the beep.</voice>
<% else %>
<voice>Continue at the beep.</voice>
<% end if %>
</prompt>
<filled>
<assign name="nextkey" expr="recording$.termchar"/>
<if cond="nextkey=='4'">
<submit next="process_record_savevox.xml?next=reviewrewind" method="post" namelist="recording" enctype="multipart/form-data"/>
<elseif cond="nextkey=='5'"/>
<submit next="process_record_savevox.xml?next=pause" method="post" namelist="recording" enctype="multipart/form-data"/>
<elseif cond="nextkey=='6'"/>
<submit next="process_record_savevox.xml?next=reviewforward" method="post" namelist="recording" enctype="multipart/form-data"/>
<elseif cond="nextkey=='7'"/>
<submit next="process_record_savevox.xml?next=reviewbeginning" method="post" namelist="recording" enctype="multipart/form-data"/>
<elseif cond="nextkey=='8'"/>
<% if (cstr(strCancelFlag) = "1") then %>
<submit next="process_record_savevox.xml?next=cancel" method="post" namelist="recording" enctype="multipart/form-data"/>
<% else %>
<submit next="process_record_savevox.xml?next=badcancel" method="post" namelist="recording" enctype="multipart/form-data"/>
<% end if %>
<elseif cond="nextkey=='*'"/>
<submit next="process_record_savevox.xml?next=hangup" method="post" namelist="recording" enctype="multipart/form-data"/>
<elseif cond="nextkey=='#'"/>
<submit next="process_record_savevox.xml?next=saveandreprompt" method="post" namelist="recording" enctype="multipart/form-data"/>
<elseif cond="nextkey=='0'"/>
<submit next="process_record_savevox.xml?next=help" method="post" namelist="recording" enctype="multipart/form-data"/>
<elseif cond="nextkey=='9'"/>
<submit next="process_record_savevox.xml?next=help" method="post" namelist="recording" enctype="multipart/form-data"/>
<else/>
<submit next="process_record_savevox.xml?next=saveandreprompt" method="post" namelist="recording" enctype="multipart/form-data"/>
</if>
</filled>
<catch event="nomatch noinput">
<prompt>Saving dictation. Expected another key press.</prompt>
<submit next="process_record_savevox.xml?next=saveandreprompt" method="post" namelist="recording" enctype="multipart/form-data"/>
</catch>
<catch event="connection.disconnect">
<submit next="process_record_savevox.xml?next=hangup" method="post" namelist="recording" enctype="multipart/form-data"/>
</catch>
</record>
<catch event="nomatch noinput">
<prompt>Saving dictation. Expected another key press.</prompt>
<submit next="process_record_savevox.xml?next=saveandreprompt" method="post" namelist="recording" enctype="multipart/form-data"/>
</catch>
<catch event="connection.disconnect">
<submit next="process_record_savevox.xml?next=hangup" method="post" namelist="recording" enctype="multipart/form-data"/>
</catch>
</form>
</vxml>
process_record_savevox.xml
<?xml version="1.0"?>
<vxml version="2.1">
<meta name="speak_exceptions" content="true"/>
<!--#include file="clsXMLConstants.asp"-->
<!--#include file="clsXMLDatabase.asp"-->
<!--#include file="clsXMLSaveRecording.asp"-->
<!--#include file="clsXMLSessionManager.asp"-->
<!--#include file="clsXMLUtilities.asp"-->
<!--#include file="clsXMLVariables.asp"-->
<%
dim strNext
strNext = Request("next")
GetSessionValues
strFileCount = trim(strFileCount)
if strFileCount = "" then
strFileCount = "1"
end if
dim strTempSaveFolder
strTempSaveFolder = "m:\WebSites\metroscript_stage\tempupload\tempvoicefiles\" & session("foldernumber") & "\"
byteCount = Request.TotalBytes
RequestBin = Request.BinaryRead(byteCount)
Dim UploadRequest
Set UploadRequest = CreateObject("Scripting.Dictionary")
BuildUploadRequest RequestBin
picture = UploadRequest.Item("recording").Item("Value")
Filename = "phone_file"
Set FileSystem = CreateObject ("Scripting.FileSystemObject" )
Set WaveFile = FileSystem.CreateTextFile ( strTempSaveFolder & filename & "_" & strFileCount & ".vox")
WaveFile.Write getString(picture)
WaveFile.Close
Set FileSystem = Nothing
Set WaveFile = Nothing
SaveSessionValues
%>
<% if ( strNext = "pause" ) then %>
<menu id="pausemenu">
<property name="inputmodes" value="dtmf"/>
<prompt>
<voice>
Enter
<enumerate><value expr="_dtmf"/> <value expr="_prompt"/>, <break size="small"/></enumerate>
</voice>
</prompt>
<choice dtmf="5" next="process_record_start.xml">to continue</choice>
</menu>
<% elseif ( strNext = "cancel" ) then %>
<menu id="pausemenu">
<property name="inputmodes" value="dtmf"/>
<prompt>
<voice>
Enter
<enumerate><value expr="_dtmf"/> <value expr="_prompt"/>, <break size="small"/></enumerate>
</voice>
</prompt>
<choice dtmf="8" next="process_record_cancel.xml">to verify the cancellation</choice>
<choice dtmf="1" next="process_record_start.xml">to continue recording</choice>
<choice dtmf="2" next="process_record_start.xml">to continue recording</choice>
<choice dtmf="4" next="process_combine_voxs.xml?next=reviewrewind">to rewind ten seconds and review dictation</choice>
<choice dtmf="7" next="process_combine_voxs.xml?next=reviewbeginning">to rewind to the beginning and review dictation</choice>
<choice dtmf="*" next="process_combine_voxs.xml?next=hangup">to save and hangup</choice>
<choice dtmf="0" next="process_combine_voxs.xml?next=saveandreprompt">to save and record another dictation</choice>
</menu>
<% elseif ( strNext = "badcancel" ) then %>
<menu id="badcancelmenu">
<property name="inputmodes" value="dtmf"/>
<prompt>
<voice>The cancel feature is not activated for your account. Please contact your system administrator</voice>
<voice>
Enter
<enumerate><value expr="_dtmf"/> <value expr="_prompt"/>, <break size="small"/></enumerate>
</voice>
</prompt>
<choice dtmf="1" next="process_record_start.xml">to continue recording</choice>
<choice dtmf="2" next="process_record_start.xml">to continue recording</choice>
<choice dtmf="4" next="process_combine_voxs.xml?next=reviewrewind">to rewind ten seconds and review dictation</choice>
<choice dtmf="7" next="process_combine_voxs.xml?next=reviewbeginning">to rewind to the beginning and review dictation</choice>
<choice dtmf="*" next="process_combine_voxs.xml?next=hangup">to save and hangup</choice>
<choice dtmf="0" next="process_combine_voxs.xml?next=saveandreprompt">to save and record another dictation</choice>
</menu>
<% elseif ( strNext = "reviewrewind" ) then %>
<form id="rewind">
<block>
<submit next="process_combine_voxs.xml?next=reviewrewind" method="post"/>
</block>
</form>
<% elseif ( strNext = "reviewforward" ) then %>
<form id="forward">
<block>
<submit next="process_combine_voxs.xml?next=reviewforward" method="post"/>
</block>
</form>
<% elseif ( strNext = "reviewbeginning" ) then %>
<form id="beginning">
<block>
<submit next="process_combine_voxs.xml?next=reviewbeginning" method="post"/>
</block>
</form>
<% elseif ( strNext = "saveandreprompt" ) then %>
<form id="save">
<block>
<submit next="process_combine_voxs.xml?next=saveandreprompt" method="post"/>
</block>
</form>
<% elseif ( strNext = "hangup" ) then %>
<form id="finish">
<block>
<submit next="process_combine_voxs.xml?next=hangup" method="post"/>
</block>
</form>
<% elseif ( strNext = "help" ) then %>
<form id="finish">
<block>
<submit next="process_combine_voxs.xml?next=help" method="post"/>
</block>
</form>
<% end if %>
<form id="debug">
<block>
<prompt>
Next <% = strNext %>.
</prompt>
<exit/>
</block>
</form>
<form id="debug2">
<block>
<prompt>
User ID <% = strUserID %>.
User Name <% = strUserName %>.
Confirm <% = strConfirmNum %>.
Call ID <% = strCallID %>.
Cancel Flag <% = strCancelFlag %>.
Stat Level <% = strStatLevel %>.
Start <% = strPositionStart %>.
End <% = strPositionEnd %>.
Folder <% = strFolderNumber %>.
File Count <% = strFileCount %>.
Folder List <% = strFolderList %>.
Recording Flag <% = strRecordingFlag %>.
</prompt>
<exit/>
</block>
</form>
</vxml>
saverecording.asp
<%
Dim Filename
Dim FileSystem
Dim WaveFile
Dim binRead
Dim byteCount
'Byte string to string conversion
Function getString(StringBin)
getString =""
For intCount = 1 to LenB(StringBin)
getString = getString & chr(AscB(MidB(StringBin,intCount,1)))
Next
End Function
'String to byte string conversion
Function getByteString(StringStr)
For i = 1 to Len(StringStr)
char = Mid(StringStr,i,1)
getByteString = getByteString & chrB(AscB(char))
Next
End Function
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 objects are put in a dictionary object
Dim UploadControl
Set UploadControl = CreateObject("Scripting.Dictionary")
'Get an 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
'Add dictionary object to main dictionary
UploadRequest.Add name, UploadControl
'Loop to next object
BoundaryPos=InstrB(BoundaryPos+LenB(boundary),RequestBin,boundary)
Loop
End Sub
%>
I realize that you are not in the business of answering ASP questions, but I am wondering if you have any code examples that you could provide that illustrate other ways of saving a recording via ASP. Attached below is the current code I am using to record and save. The problem is that the system will throw an error if I try to record more than 25 seconds, even if I push out the maxtime to 120 seconds. All I want to do is take the recording and save it to a .vox file on my server with as little latency as possible.
Thanks so much,
Mike C.
Current files and what they do:
1. process_record_start.xml - records the user input
2. process_record_savevox.xml - gets the user input and saves it to a file
3. saverecording.asp - contains BuildUploadRequest which is used by process_record_savevox.xml
process_record_start.xml
<?xml version="1.0"?>
<vxml version="2.1">
<meta name="speak_exceptions" content="true"/>
<!--#include file="clsXMLConstants.asp"-->
<!--#include file="clsXMLDatabase.asp"-->
<!--#include file="clsXMLSessionManager.asp"-->
<!--#include file="clsXMLUtilities.asp"-->
<!--#include file="clsXMLVariables.asp"-->
<%
GetSessionValues
strFileCount = cint(strFileCount) + 1
SaveSessionValues
%>
<form id="record">
<grammar>1|2|3|4|5|6|7|8|9|0|"*"|"#"</grammar>
<record name="recording" beep="true" dtmfterm="true" maxtime="120s" finalsilence="5s" type="audio/basic">
<prompt bargein="false">
<% if ( cint(strFileCount) <= 1 ) then
'Log the dictation
'stored procedure: sp_insert_phone_in_log_record
'tables: phone_log
set conDatabase = Server.CreateObject("ADODB.Connection")
conDatabase.Open strConnection
objXMLUtilities.SetDictationStarted2 "L", strUserID, strFolderNumber, strCallID, 0
conDatabase.Close
%>
<voice>Record at the beep.</voice>
<% else %>
<voice>Continue at the beep.</voice>
<% end if %>
</prompt>
<filled>
<assign name="nextkey" expr="recording$.termchar"/>
<if cond="nextkey=='4'">
<submit next="process_record_savevox.xml?next=reviewrewind" method="post" namelist="recording" enctype="multipart/form-data"/>
<elseif cond="nextkey=='5'"/>
<submit next="process_record_savevox.xml?next=pause" method="post" namelist="recording" enctype="multipart/form-data"/>
<elseif cond="nextkey=='6'"/>
<submit next="process_record_savevox.xml?next=reviewforward" method="post" namelist="recording" enctype="multipart/form-data"/>
<elseif cond="nextkey=='7'"/>
<submit next="process_record_savevox.xml?next=reviewbeginning" method="post" namelist="recording" enctype="multipart/form-data"/>
<elseif cond="nextkey=='8'"/>
<% if (cstr(strCancelFlag) = "1") then %>
<submit next="process_record_savevox.xml?next=cancel" method="post" namelist="recording" enctype="multipart/form-data"/>
<% else %>
<submit next="process_record_savevox.xml?next=badcancel" method="post" namelist="recording" enctype="multipart/form-data"/>
<% end if %>
<elseif cond="nextkey=='*'"/>
<submit next="process_record_savevox.xml?next=hangup" method="post" namelist="recording" enctype="multipart/form-data"/>
<elseif cond="nextkey=='#'"/>
<submit next="process_record_savevox.xml?next=saveandreprompt" method="post" namelist="recording" enctype="multipart/form-data"/>
<elseif cond="nextkey=='0'"/>
<submit next="process_record_savevox.xml?next=help" method="post" namelist="recording" enctype="multipart/form-data"/>
<elseif cond="nextkey=='9'"/>
<submit next="process_record_savevox.xml?next=help" method="post" namelist="recording" enctype="multipart/form-data"/>
<else/>
<submit next="process_record_savevox.xml?next=saveandreprompt" method="post" namelist="recording" enctype="multipart/form-data"/>
</if>
</filled>
<catch event="nomatch noinput">
<prompt>Saving dictation. Expected another key press.</prompt>
<submit next="process_record_savevox.xml?next=saveandreprompt" method="post" namelist="recording" enctype="multipart/form-data"/>
</catch>
<catch event="connection.disconnect">
<submit next="process_record_savevox.xml?next=hangup" method="post" namelist="recording" enctype="multipart/form-data"/>
</catch>
</record>
<catch event="nomatch noinput">
<prompt>Saving dictation. Expected another key press.</prompt>
<submit next="process_record_savevox.xml?next=saveandreprompt" method="post" namelist="recording" enctype="multipart/form-data"/>
</catch>
<catch event="connection.disconnect">
<submit next="process_record_savevox.xml?next=hangup" method="post" namelist="recording" enctype="multipart/form-data"/>
</catch>
</form>
</vxml>
process_record_savevox.xml
<?xml version="1.0"?>
<vxml version="2.1">
<meta name="speak_exceptions" content="true"/>
<!--#include file="clsXMLConstants.asp"-->
<!--#include file="clsXMLDatabase.asp"-->
<!--#include file="clsXMLSaveRecording.asp"-->
<!--#include file="clsXMLSessionManager.asp"-->
<!--#include file="clsXMLUtilities.asp"-->
<!--#include file="clsXMLVariables.asp"-->
<%
dim strNext
strNext = Request("next")
GetSessionValues
strFileCount = trim(strFileCount)
if strFileCount = "" then
strFileCount = "1"
end if
dim strTempSaveFolder
strTempSaveFolder = "m:\WebSites\metroscript_stage\tempupload\tempvoicefiles\" & session("foldernumber") & "\"
byteCount = Request.TotalBytes
RequestBin = Request.BinaryRead(byteCount)
Dim UploadRequest
Set UploadRequest = CreateObject("Scripting.Dictionary")
BuildUploadRequest RequestBin
picture = UploadRequest.Item("recording").Item("Value")
Filename = "phone_file"
Set FileSystem = CreateObject ("Scripting.FileSystemObject" )
Set WaveFile = FileSystem.CreateTextFile ( strTempSaveFolder & filename & "_" & strFileCount & ".vox")
WaveFile.Write getString(picture)
WaveFile.Close
Set FileSystem = Nothing
Set WaveFile = Nothing
SaveSessionValues
%>
<% if ( strNext = "pause" ) then %>
<menu id="pausemenu">
<property name="inputmodes" value="dtmf"/>
<prompt>
<voice>
Enter
<enumerate><value expr="_dtmf"/> <value expr="_prompt"/>, <break size="small"/></enumerate>
</voice>
</prompt>
<choice dtmf="5" next="process_record_start.xml">to continue</choice>
</menu>
<% elseif ( strNext = "cancel" ) then %>
<menu id="pausemenu">
<property name="inputmodes" value="dtmf"/>
<prompt>
<voice>
Enter
<enumerate><value expr="_dtmf"/> <value expr="_prompt"/>, <break size="small"/></enumerate>
</voice>
</prompt>
<choice dtmf="8" next="process_record_cancel.xml">to verify the cancellation</choice>
<choice dtmf="1" next="process_record_start.xml">to continue recording</choice>
<choice dtmf="2" next="process_record_start.xml">to continue recording</choice>
<choice dtmf="4" next="process_combine_voxs.xml?next=reviewrewind">to rewind ten seconds and review dictation</choice>
<choice dtmf="7" next="process_combine_voxs.xml?next=reviewbeginning">to rewind to the beginning and review dictation</choice>
<choice dtmf="*" next="process_combine_voxs.xml?next=hangup">to save and hangup</choice>
<choice dtmf="0" next="process_combine_voxs.xml?next=saveandreprompt">to save and record another dictation</choice>
</menu>
<% elseif ( strNext = "badcancel" ) then %>
<menu id="badcancelmenu">
<property name="inputmodes" value="dtmf"/>
<prompt>
<voice>The cancel feature is not activated for your account. Please contact your system administrator</voice>
<voice>
Enter
<enumerate><value expr="_dtmf"/> <value expr="_prompt"/>, <break size="small"/></enumerate>
</voice>
</prompt>
<choice dtmf="1" next="process_record_start.xml">to continue recording</choice>
<choice dtmf="2" next="process_record_start.xml">to continue recording</choice>
<choice dtmf="4" next="process_combine_voxs.xml?next=reviewrewind">to rewind ten seconds and review dictation</choice>
<choice dtmf="7" next="process_combine_voxs.xml?next=reviewbeginning">to rewind to the beginning and review dictation</choice>
<choice dtmf="*" next="process_combine_voxs.xml?next=hangup">to save and hangup</choice>
<choice dtmf="0" next="process_combine_voxs.xml?next=saveandreprompt">to save and record another dictation</choice>
</menu>
<% elseif ( strNext = "reviewrewind" ) then %>
<form id="rewind">
<block>
<submit next="process_combine_voxs.xml?next=reviewrewind" method="post"/>
</block>
</form>
<% elseif ( strNext = "reviewforward" ) then %>
<form id="forward">
<block>
<submit next="process_combine_voxs.xml?next=reviewforward" method="post"/>
</block>
</form>
<% elseif ( strNext = "reviewbeginning" ) then %>
<form id="beginning">
<block>
<submit next="process_combine_voxs.xml?next=reviewbeginning" method="post"/>
</block>
</form>
<% elseif ( strNext = "saveandreprompt" ) then %>
<form id="save">
<block>
<submit next="process_combine_voxs.xml?next=saveandreprompt" method="post"/>
</block>
</form>
<% elseif ( strNext = "hangup" ) then %>
<form id="finish">
<block>
<submit next="process_combine_voxs.xml?next=hangup" method="post"/>
</block>
</form>
<% elseif ( strNext = "help" ) then %>
<form id="finish">
<block>
<submit next="process_combine_voxs.xml?next=help" method="post"/>
</block>
</form>
<% end if %>
<form id="debug">
<block>
<prompt>
Next <% = strNext %>.
</prompt>
<exit/>
</block>
</form>
<form id="debug2">
<block>
<prompt>
User ID <% = strUserID %>.
User Name <% = strUserName %>.
Confirm <% = strConfirmNum %>.
Call ID <% = strCallID %>.
Cancel Flag <% = strCancelFlag %>.
Stat Level <% = strStatLevel %>.
Start <% = strPositionStart %>.
End <% = strPositionEnd %>.
Folder <% = strFolderNumber %>.
File Count <% = strFileCount %>.
Folder List <% = strFolderList %>.
Recording Flag <% = strRecordingFlag %>.
</prompt>
<exit/>
</block>
</form>
</vxml>
saverecording.asp
<%
Dim Filename
Dim FileSystem
Dim WaveFile
Dim binRead
Dim byteCount
'Byte string to string conversion
Function getString(StringBin)
getString =""
For intCount = 1 to LenB(StringBin)
getString = getString & chr(AscB(MidB(StringBin,intCount,1)))
Next
End Function
'String to byte string conversion
Function getByteString(StringStr)
For i = 1 to Len(StringStr)
char = Mid(StringStr,i,1)
getByteString = getByteString & chrB(AscB(char))
Next
End Function
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 objects are put in a dictionary object
Dim UploadControl
Set UploadControl = CreateObject("Scripting.Dictionary")
'Get an 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
'Add dictionary object to main dictionary
UploadRequest.Add name, UploadControl
'Loop to next object
BoundaryPos=InstrB(BoundaryPos+LenB(boundary),RequestBin,boundary)
Loop
End Sub
%>