Question[Help]FTP Program[Solved]

Posts 1–5 of 5 · Page 1 of 1
[Help]FTP Program[Solved]
Okay I got it to upload and every things working...But I want it to insert the link to what I just uploaded into TextBox4.Text


How would I do that, all I got to do is get the name of the document then insert it into the Textbox...


+1 Thanks +Rep


Thanks.
Post your current code.
The Code
Code:
Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        
    End Sub

    Private Sub OpenFileDialog1_FileOk(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles OpenFileDialog1.FileOk
        TextBox4.Text = OpenFileDialog1.FileName
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If TextBox1.Text = "FTPUsername" And TextBox2.Text = "FTPPassword" Then  'All that is just for security 
            Dim request As System.Net.FtpWebRequest = DirectCast(System.Net.WebRequest.Create("ftp://ftp.TheSite.org/Images/uploaded"), System.Net.FtpWebRequest)
            request.Credentials = New System.Net.NetworkCredential(TextBox1.Text, TextBox2.Text)
            request.Method = System.Net.WebRequestMethods.Ftp.UploadFile

            Dim file() As Byte = System.IO.File.ReadAllBytes(TextBox3.Text)

            Dim strz As System.IO.Stream = request.GetRequestStream()
            strz.Write(file, 0, file.Length)
            strz.Close()
            strz.Dispose()
        Else
            MsgBox("Incorrect Username or Password!", MsgBoxStyle.Critical)
        End If

        TextBox4.Text = "www.TheSite.org/Images/uploaded/"
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        OpenFileDialog1.ShowDialog()
    End Sub
End Class
Code:
TextBox4.Text = "www.TheSite.org/Images/uploaded/" & IO.Path.GetFileName(TextBox3.Text)
This?
Yes thanks ALOT

+thanks and +rep
Posts 1–5 of 5 · Page 1 of 1
This thread is closed for replies.

Tags for this Thread

None

Talk with us