Jump to content

Send .php file to webhost - FTP

Recommended Posts

Hi, i'm doing an app, in Visual Basic 2008, that manages a music school and i have to do a secction where the administration inserts instruments/courses.As every course has its own program (what you learn). i did a RichTextBox where the admin writes the program and then save as a .php file. Here's the code that sends the file:

Imports System.IOPublic Class curso_prog    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click	    Close()    End Sub    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click	    Dim myStream As Stream	    Dim saveFileDialog1 As New SaveFileDialog()	    saveFileDialog1.Filter = "PHP files (*.php)|*.php"	    saveFileDialog1.FilterIndex = 2	    saveFileDialog1.RestoreDirectory = True	    If saveFileDialog1.ShowDialog() = DialogResult.OK Then		    myStream = saveFileDialog1.OpenFile()		    If (myStream IsNot Nothing) Then			    'Create the file stream for writing			    Dim stream As New StreamWriter(myStream)			    'Write the include statement for the header			    stream.WriteLine("<?PHP include 'topo.php'; ?>")			    'And now, write out all the lines from the richtextbox			    For Each line As String In RichTextBox1.Lines()				    stream.WriteLine(line)			    Next			    'Write the include statement for the footer			    stream.WriteLine("<?PHP include 'rodape.php'; ?>")			    'Flush and close the stream when you're done			    stream.Flush()			    stream.Close()			    myStream.Close()		    End If	    End If    End Sub    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click	    RichTextBox1.Text = ""    End Sub    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click	    curso_add.TextBox3.Text = SaveFileDialog1.FileName    End SubEnd Class

What i want to do now is when i press "OK" the file is sent to my webhost via FTP. Can some one help me? Thank you,PF2G

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...