Quantcast
Channel: Chilkat Forum - latest questions
Viewing all articles
Browse latest Browse all 1061

Access is denied on GetFile

$
0
0

"Access is Denied" error occurs when attempting to download a file from a FTP site. Connection to the site is successful. What is denied? The file on the ftp or the folder where the file is to be downloaded?

If it's a permissions issue, then why is connecting to the site successful?

Code: Dim extractPath As String = "xxx"

    If Not Directory.Exists(extractPath) Then
        Directory.CreateDirectory(extractPath)
    End If

    Dim ftp As New Chilkat.Ftp2

    Dim success As Boolean
    success = ftp.UnlockComponent("cccc")

    If (success <> True) Then
        FTPFailure(ftp.LastErrorText, String.Empty)
    Else
        ftp.Hostname = "xxx"
        ftp.Username = "yyy"
        ftp.Password = "zzz"

        '  Connect and login to the FTP server.
        success = ftp.Connect()
        If (success <> True) Then
            FTPFailure(ftp.LastErrorText, String.Empty)
            Exit Sub
        End If

        '  Change to the remote directory where the file will be uploaded.
        success = ftp.ChangeRemoteDir("/")
        If (success <> True) Then
            FTPFailure(ftp.LastErrorText, String.Empty)
            Exit Sub
        End If

        '  Download file to extractPath
        'SUCCESS RETURNS FALSE HERE.
        success = ftp.GetFile("aaa-bbb.png", extractPath)
        If (success <> True) Then
            FTPFailure(ftp.LastErrorText, String.Empty)
            Exit Sub
        End If
    End If

The folder is accessible on this computer thru windows explorer. Thanks for any help or advice.


Viewing all articles
Browse latest Browse all 1061

Trending Articles