Jump to content

pf2g

Members
  • Content count

    1
  • Joined

  • Last visited

Community Reputation

0 Neutral

About pf2g

  • Rank
    Newbie
  • Birthday 06/10/1992

Contact Methods

  • MSN
    paulo-diablo92@live.com.pt

Profile Information

  • Location
    Portugal

Previous Fields

  • Languages
    PHP, HTML, Visual Basic
  1. Send .php file to webhost - FTP

    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
×