Mime Header -- Read Parameter Value

G

Guest

Transferring several .wav files at one time from a vxml platform to a server
using multipart/form-data in VB.net.

The transfer and saving of the separate wav files works fine.

However, I need to access the name="****" value in the line below which in
this example would be "nameinfo".

Content-Disposition: form-data; name="nameinfo"; filename="vxml5f2ec39.wav"
Content-Type: audio/wav
Content-Transfer-Encoding: binary

Thanks. TomB
 
B

Bryan Martin

Dim str_Value As String = "Content-Disposition: form-data;
name=""nameinfo""; filename=""vxml5f2ec39.wav""" & vbCrLf & _
"Content-Type: audio/wav" & vbCrLf & _
"Content-Transfer-Encoding: binary"

MsgBox(PullBetween(str_Value, "name=""", """;"))

Private Function PullBetween(ByVal Value As String, ByVal StartString As
String, ByVal EndString As String) As String
Dim int_startPos As Integer
Dim int_endPos As Integer

' Get to the beginning
int_startPos = Value.IndexOf(StartString)
If int_startPos = -1 Then Return Nothing
int_startPos = int_startPos + StartString.Length + 1
Value = Mid(Value, int_startPos)

' now get the ending
int_endPos = Value.IndexOf(EndString)
If int_endPos = -1 Then int_endPos = Value.Length
Value = Mid(Value, 1, int_endPos)
Return Value
End Function


Is this what your after?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top