I have been trying to research how to get a file (basically a csv file) from a url to an array and my search has come up with some examples, but not quite what I am looking for. Would appreciated any direction and or other examples of folks that have done this before.
Basically we have a cloud computer set up (Hadoop) and the output of some of our processes is what I am trying to get to..
the file is something like
http://ourserver...com:port#/filetos...es/actual_file
so if you put that in a browser, a 'save file dialog comes up' so i know the link if valid.
In .net was looking into using SYSTEM.NET and a simple downloadfile sub
Expand|Select|Wrap|Line Numbers
- Public Sub DownLoadFile(ByVal address As String, _
- ByVal fileName As String)
- End Sub
also read this bit of code somewhere but it has to do with images and again it only downloads doesn't really interact with the stream
Expand|Select|Wrap|Line Numbers
- Dim wr As HttpWebRequest = CType(WebRequest.Create(sfile), HttpWebRequest)
- Dim ws As HttpWebResponse = CType(wr.GetResponse(), HttpWebResponse)
- Dim str As Stream = ws.GetResponseStream()
- Dim inbuf(1000000) As Byte
- Dim bytesToRead As Integer = CInt(inbuf.Length)
- Dim bytesRead As Integer = 0
- While bytesToRead > 0
- Dim n As Integer = str.Read(inbuf, bytesRead, bytesToRead)
- If n = 0 Then
- Exit While
- End If
- bytesRead += n
- bytesToRead -= n
- End While
Thanks ahead of time,
Eric