This is a webmethod that takes a file and convert it back out to a Binary Stream
<WebMethod()> _
Public Function ReadFileToStream() As Byte()
Dim fs As FileStream
Try
' Read file and return contents
Dim serverPath As String = "C:\Inetpub\wwwroot\postinfo.html"
fs = File.Open(serverPath, FileMode.Open, FileAccess.Read)
Dim lngLen As Long = fs.Length
Dim abytBuffer(CInt(lngLen - 1)) As Byte
fs.Read(abytBuffer, 0, CInt(lngLen))
Return abytBuffer
Finally
' Make sure that file stream is
' closed even if an error occurs.
fs.Close()
End Try
End Function
Hope this helps
"Charles A. Lackman" wrote:
Hello,
Is there a way to Write a file to a stream using a web service? If so How?
Any Help or Suggestions will be greatly appreciated.
Thanks,
Chuck