hidden ftp upload
Posted: Fri Feb 10, 2012 9:05 pm
hi how do i make a hidden ftp upload? liek i dont want the progressbarr dialog to show when u upload somethign to your ftp.
Sharing, Teaching and Supporting coders of all ages and levels since 2009
https://www.codenstuff.com/forum/
Dim wcl As New Net.WebClient
wcl.Credentials = New Net.NetworkCredential("user", "pass")
wcl.UploadFile("address", "fileloc") ' Then you use multi-threading to stop it from freezing your application or just use: wcl.UploadFileAsync(New Uri("address"), "fileloc")
My.Computer.Network.UploadFile("c:\File.txt", "http://www.someserver.com/upload.aspx", "username", "password", False, 500)
Dim Upload As System.Net.FtpWebRequest = DirectCast(System.Net.WebRequest.Create("ftp://ftp.YOURSITE.com/SaveUploadedFileToThisName.txt"), System.Net.FtpWebRequest)
Upload.Credentials = New System.Net.NetworkCredential("USERNAME", "PASSWORD")
Upload.Method = System.Net.WebRequestMethods.Ftp.UploadFile
Dim Enc As New System.Text.UTF8Encoding()
Dim File() As Byte = Enc.GetBytes("C:\FileToUpload.txt")
Dim UploadStream As System.IO.Stream = Upload.GetRequestStream()
UploadStream.Write(File, 0, File.Length)
UploadStream.Close()
UploadStream.Dispose()
macHard wrote:Hello, try using WebClient.What do you meane with my program will freeze? Also could you explain more how it could make it not to freeze dident really get it.
Code: Select allDim wcl As New Net.WebClient wcl.Credentials = New Net.NetworkCredential("user", "pass") wcl.UploadFile("address", "fileloc") ' Then you use multi-threading to stop it from freezing your application or just use: wcl.UploadFileAsync(New Uri("address"), "fileloc")
Martin wrote:Let's say this code works through a button on the form. You click it, then this program will just wait till the function is completed, in this case file upload. That prevents you to do anything on the form until file upload is complete.macHard wrote:Hello, try using WebClient.What do you meane with my program will freeze? Also could you explain more how it could make it not to freeze dident really get it.
Code: Select allDim wcl As New Net.WebClient wcl.Credentials = New Net.NetworkCredential("user", "pass") wcl.UploadFile("address", "fileloc") ' Then you use multi-threading to stop it from freezing your application or just use: wcl.UploadFileAsync(New Uri("address"), "fileloc")