Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Dim filePath As String = lbl_file.Text
- Dim slashPosition As Integer = filePath.LastIndexOf("\")
- Dim filenameOnly As String = filePath.Substring(slashPosition + 1)
- Dim request As System.Net.FtpWebRequest = DirectCast(System.Net.WebRequest.Create("ftp://url.com/public_html/windows/" & filenameOnly), System.Net.FtpWebRequest)
- request.Credentials = New System.Net.NetworkCredential("file", "password")
- request.Method = System.Net.WebRequestMethods.Ftp.UploadFile
- Dim path As String = lbl_file.Text
- Dim file() As Byte = System.IO.File.ReadAllBytes(path)
- Dim strz As System.IO.Stream = request.GetRequestStream()
- For offset As Integer = 0 To file.Length Step 1024
- lbl_progress.Text = offset.ToString() + " bytes sent"
- Dim chunkSize As Integer = file.Length - offset - 1
- If chunkSize > 1024 Then chunkSize = 1024
- strz.Write(file, offset, chunkSize)
- Next
- lbl_progress.Text = file.Length + " bytes sent"
- strz.Close()
- strz.Dispose()
- MsgBox(path)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement