Jak stworzyć katalog na serwerze FTP?

0
    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        Dim myftprequest As Net.FtpWebRequest = CType(System.Net.FtpWebRequest.Create("ftp://adres_ftp/public_html/nazwa_folderu"), System.Net.FtpWebRequest)
        myftprequest.Credentials = New System.Net.NetworkCredential("username", "haslo")
        myftprequest.Method = System.Net.WebRequestMethods.Ftp.MakeDirectory

    End Sub

co robie źle? dlaczego nie moge stworzyc folderu o nazwie "nazwa_folderu" ?

0

Nie znam się na vb. Ale czy przypadkiem nie trzeba jakoś najpierw zmienić folder nadrzędny na public_html?

0

udalo mi sie tworzyc folder w ten sposob:

    Private Function FtpFolderCreate(folder_name As String, username As String, password As String) As Boolean
        Dim request As Net.FtpWebRequest = CType(FtpWebRequest.Create("ftp://moja_strona/public_html/nazwa_folderu"), FtpWebRequest)
        request.Credentials = New NetworkCredential("login", "haslo")
        request.Method = WebRequestMethods.Ftp.MakeDirectory

        Try
            Using response As FtpWebResponse = DirectCast(request.GetResponse(), FtpWebResponse)
                ' Folder created
            End Using
        Catch ex As WebException
            Dim response As FtpWebResponse = DirectCast(ex.Response, FtpWebResponse)
            ' an error occurred
            If response.StatusCode = FtpStatusCode.ActionNotTakenFileUnavailable Then
                Return False
            End If
        End Try
        Return True
    End Function

1 użytkowników online, w tym zalogowanych: 0, gości: 1, botów: 0