Question:
"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.
Sorry for my late response. Here is lastErrorText:
ChilkatLog: GetFile: DllDate: Aug 26 2015 ChilkatVersion: 9.5.0.52 UnlockPrefix: ISSVCCFTP Username: aaa:bbb Architecture: Little Endian; 32-bit Language: .NET 4.0 VerboseLogging: 1 ProgressMonitoring: enabled: yes heartbeatMs: 0 sendBufferSize: 65536 --ProgressMonitoring downloadToFile: localFilename: C:\xxx\Images\unzipped Replacing existing local file openForReadWriteWin32: WindowsError: Access is denied. WindowsErrorCode: 0x5 win32CreateFileAnsi failed. localFilePath: C:\xxx\Images\unzipped currentWorkingDirectory: C:\ddd\eee\fff\bin\Debug localWindowsFilePath: C:\xxx\Images\unzipped --openForReadWriteWin32 --downloadToFile Failed. --GetFile --ChilkatLog
Is this a permissions issue? I've tried other ftp sites and have the same problem. However, I can upload to any site. I cannot download from any site.
I'm not sure what to tell my IT administrator what I need to be able to download. I need permissions....to what?
Thanks
This is a local file creation error! "win32CreateFileAnsi failed." does the full path "C:\xxx\Images\unzipped" Exist? shouldn't there be a trailing "\" can your program create a "text" file in the above folder with out Chilkat, Using native code? try this code dim FF as long Open "C:\xxx\Images\unzipped\TEST.TXT" For Output Lock write As FF ' Note Trailing backslash in path Write #FF, "This is just a dummy test file." close FF if that code creates the test.txt file without error then it's the "\" if you get a permission error then you don't have the right to create/write data to that folder. and the error/problem is not a CHILKAT error
I just noticed in your LastErrorText that the localfilename has no filename part
"localFilename: C:/xxx/Images/unzipped"
also the forum understandably does not like backslashes.
whats the value of extractpath just before you call getfile?
I started that last post and walked away and you posted.... glad you figured it out.