Page 1 of 1

hidden ftp upload

Posted: Fri Feb 10, 2012 9:05 pm
by Martin
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.

Re: hidden ftp upload

Posted: Fri Feb 10, 2012 9:17 pm
by bisnes_niko
Hello, try using WebClient.
Code: Select all
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")


Re: hidden ftp upload

Posted: Fri Feb 10, 2012 9:19 pm
by dan2130
If you have a web hosting in the same server you can simply create a page with a php script for upload of files and you just upload your file at this address and it will show nothing

Re: hidden ftp upload

Posted: Fri Feb 10, 2012 9:27 pm
by CodenStuff
Or this:
Code: Select all
My.Computer.Network.UploadFile("c:\File.txt", "http://www.someserver.com/upload.aspx", "username", "password", False, 500)
Or this:
Code: Select all
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()

Re: hidden ftp upload

Posted: Fri Feb 10, 2012 9:32 pm
by Martin
macHard wrote:
Hello, try using WebClient.
Code: Select all
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")

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.

Re: hidden ftp upload

Posted: Sat Feb 11, 2012 9:52 am
by bisnes_niko
Martin wrote:
macHard wrote:
Hello, try using WebClient.
Code: Select all
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")

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.
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.