Hi all,
I've been writing a program that simply streams the stock list from our website to a csv file on our users computer.
What i would like to do now is either take that stream and create a file on an ftp site, or download the stream to a file the copy the file to an ftp site.
I have scoured the web and tek-tips and came across many examples, many of which say they are not working (and after testing, didn't work for me either) I have added the latest couple i have tested to no avail...
using something simple get error
My.Computer.Network.UploadFile(Me.txtLocation.Text & "\myFile.csv", "ftp://MYFTP/myFile.csv")
The remote server returned an error: (550) File unavailable (e.g., file not found, no access).
and as follows where webpagesource is the stream of data
Dim fileContents As Byte() = Encoding.UTF8.GetBytes(WebPageSourceCode)
Dim remoteFile As String = "ftp://IPAddress/myFile.csv"
Dim username As String = "user"
Dim password As String = "pass"
'Get the object used to communicate with the server.
Dim Request As System.Net.FtpWebRequest = FtpWebRequest.Create(remoteFile)
' Setting Properties
Request.Credentials = New NetworkCredential(username, password)
Request.Method = System.Net.WebRequestMethods.Ftp.UploadFile
Request.Proxy = Nothing
Request.KeepAlive = False
' Uploading file
Request.GetRequestStream.Write(fileContents, 0, fileContents.Length)
MsgBox("File Uploaded Successfully !!!")
The remote server returned an error: (550) File unavailable (e.g., file not found, no access).
Also tried
Dim up As New Net.WebClient
up.Credentials = New System.Net.NetworkCredential("user", "pass")
up.UploadFile("ftp://myFTP/myFile.csv", Me.txtLocation.Text & "\myFile.csv")
The remote server returned an error: (550) File unavailable (e.g., file not found, no access).
Is it something i'm doing wrong or should these work...
Thank you
daveJam
it works on my machine, so technically i win!
I've been writing a program that simply streams the stock list from our website to a csv file on our users computer.
What i would like to do now is either take that stream and create a file on an ftp site, or download the stream to a file the copy the file to an ftp site.
I have scoured the web and tek-tips and came across many examples, many of which say they are not working (and after testing, didn't work for me either) I have added the latest couple i have tested to no avail...
using something simple get error
My.Computer.Network.UploadFile(Me.txtLocation.Text & "\myFile.csv", "ftp://MYFTP/myFile.csv")
The remote server returned an error: (550) File unavailable (e.g., file not found, no access).
and as follows where webpagesource is the stream of data
Dim fileContents As Byte() = Encoding.UTF8.GetBytes(WebPageSourceCode)
Dim remoteFile As String = "ftp://IPAddress/myFile.csv"
Dim username As String = "user"
Dim password As String = "pass"
'Get the object used to communicate with the server.
Dim Request As System.Net.FtpWebRequest = FtpWebRequest.Create(remoteFile)
' Setting Properties
Request.Credentials = New NetworkCredential(username, password)
Request.Method = System.Net.WebRequestMethods.Ftp.UploadFile
Request.Proxy = Nothing
Request.KeepAlive = False
' Uploading file
Request.GetRequestStream.Write(fileContents, 0, fileContents.Length)
MsgBox("File Uploaded Successfully !!!")
The remote server returned an error: (550) File unavailable (e.g., file not found, no access).
Also tried
Dim up As New Net.WebClient
up.Credentials = New System.Net.NetworkCredential("user", "pass")
up.UploadFile("ftp://myFTP/myFile.csv", Me.txtLocation.Text & "\myFile.csv")
The remote server returned an error: (550) File unavailable (e.g., file not found, no access).
Is it something i'm doing wrong or should these work...
Thank you
daveJam
it works on my machine, so technically i win!