Hello all,
I'm new here so I don't know if I'm posting this in the right categorie.
But what I want is to make a FTP file upload program, to place some kind of text files into another computer.
The only thing I can't get working is to refer the textbox to the Server location.
Here is my code, hope you guys can help me
:
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim request As System.Net.FtpWebRequest = DirectCast(System.Net.WebRequest.Create("ftp://(textbox1.text)/var/etc/config.cfg"), System.Net.FtpWebRequest)
request.Credentials = New System.Net.NetworkCredential("root", "dreambox")
request.Method = System.Net.WebRequestMethods.Ftp.UploadFile
Dim file() As Byte = System.IO.File.ReadAllBytes("config.cfg")
Dim strz As System.IO.Stream = request.GetRequestStream()
strz.Write(file, 0, file.Length)
strz.Close()
strz.Dispose()
End Sub
End Class
The Bold thing,, I can't get that to work..
Thanks in advance,
Deuk11
I'm new here so I don't know if I'm posting this in the right categorie.
But what I want is to make a FTP file upload program, to place some kind of text files into another computer.
The only thing I can't get working is to refer the textbox to the Server location.
Here is my code, hope you guys can help me
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim request As System.Net.FtpWebRequest = DirectCast(System.Net.WebRequest.Create("ftp://(textbox1.text)/var/etc/config.cfg"), System.Net.FtpWebRequest)
request.Credentials = New System.Net.NetworkCredential("root", "dreambox")
request.Method = System.Net.WebRequestMethods.Ftp.UploadFile
Dim file() As Byte = System.IO.File.ReadAllBytes("config.cfg")
Dim strz As System.IO.Stream = request.GetRequestStream()
strz.Write(file, 0, file.Length)
strz.Close()
strz.Dispose()
End Sub
End Class
The Bold thing,, I can't get that to work..
Thanks in advance,
Deuk11