Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27356

VS 2012 FTP: upload/download all .txt & .jpg

$
0
0
Hi, i can't figure out how to upload and download all the .txt and .jpg files

I've tried this code:
Code:

        Dim request As System.Net.FtpWebRequest = DirectCast(System.Net.WebRequest.Create(host & "*.jpg"), System.Net.FtpWebRequest)
        request.Credentials = New System.Net.NetworkCredential(username, password)
        request.Method = System.Net.WebRequestMethods.Ftp.UploadFile

        Dim file() As Byte = System.IO.File.ReadAllBytes(MainFolder & "*.jpg")
        Dim strz As System.IO.Stream = request.GetRequestStream()
        strz.Write(file, 0, file.Length)
        strz.Close()
        strz.Dispose()

But it gives an error "Illegal character in path" on this line:
Code:

        Dim file() As Byte = System.IO.File.ReadAllBytes(MainFolder & "*.jpg")

Viewing all articles
Browse latest Browse all 27356

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>