You can just read from the Dime stream and write to an open file stream
on disk
e.g.
Public Shared Sub WriteFileStream( _
ByVal fullName As String, _
ByVal instream As Stream _
)
Dim fs As New FileStream(fullName, FileMode.CreateNew)
Dim dataInt As Integer
While True
dataInt = instream.ReadByte()
If (dataInt = -1) Then
Exit While
End If
fs.WriteByte(CType(dataInt, Byte))
End While
fs.Close()
end sub
'fullName' is where you wish to put the file
'instream' is the Dime stream
The casting looks a tad strange I admit but blame the streams
ReadByte() returns an integer
WriteByte() writes a byte.
Also, if you do not have code for getting at the Dime stream, you can
use
Dim soapCon As SoapContext = RequestSoapContext.Current
WriteFileStream(fileName, soapCon.Attachments(0).Stream)
hth,
Alan.
|