Public Class Form1
    Dim WithEvents wc As New System.Net.WebClient
    Dim sfn As String
    Sub UpLoad()
        ProgressBar1.Value = 0
        Try
            wc.UploadFileAsync(New Uri("ftp://site.ru/" & sfn), TextBox4.Text)
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
    End Sub
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        UpLoad()
    End Sub
    Private Sub wc_up(ByVal sender As Object, ByVal e As System.Net.UploadProgressChangedEventArgs) Handles wc.UploadProgressChanged
        ProgressBar1.Maximum = e.TotalBytesToSend \ 1024
        ProgressBar1.Value = e.BytesSent \ 1024
        Label1.Text = "Отправлено килобайт: " & e.BytesSent \ 1024 & " из " & e.TotalBytesToSend \ 1024
        If ProgressBar1.Value = ProgressBar1.Maximum Then
            Dim rp As String
            rp = "ftp://site.ru/" & sfn
            rp = Replace(rp, "ftp", "http")
            TextBox4.Text = rp
        End If
    End Sub
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        wc.Credentials = New System.Net.NetworkCredential("Login", "Password")
    End Sub
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Dim FileDialog As New OpenFileDialog
        If FileDialog.ShowDialog = Windows.Forms.DialogResult.OK Then
            TextBox4.Text = FileDialog.FileName
            sfn = FileDialog.SafeFileName
        End If
    End Sub
End Class
