S Smee Well-Known Member Licensed User Longtime User Apr 4, 2024 #1 Good evening all I am trying to download a file from a server but I get the following error java.lang.RuntimeException: Error retrieving file. (LastException.Message) 550 I can only retrieve regular files The download code is B4X: Dim sf As Object = ftp.DownloadFile(ServerPathName, True ,Starter.gAppDirectory,"test.txt") Wait For (sf) ftp_DownloadCompleted (ServerPath As String, Success As Boolean) I have Changed True to False I have tried many file types that are on the server (.txt,. csv, .html, .xls etc etc) Nothing will download I have been able to successfully get a directory listing of files and folders but cannot download a single file The aim is to download several files but atm I can't get anything to work I can upload and download the same files with Filezilla without issue My settings are ftp.PassiveMode=True ftp.TimeoutMs=10000 I am using Net v1.81 I have searched the forums but I cant find anything to shed any light Anyone have a clue as to what is happening here?
Good evening all I am trying to download a file from a server but I get the following error java.lang.RuntimeException: Error retrieving file. (LastException.Message) 550 I can only retrieve regular files The download code is B4X: Dim sf As Object = ftp.DownloadFile(ServerPathName, True ,Starter.gAppDirectory,"test.txt") Wait For (sf) ftp_DownloadCompleted (ServerPath As String, Success As Boolean) I have Changed True to False I have tried many file types that are on the server (.txt,. csv, .html, .xls etc etc) Nothing will download I have been able to successfully get a directory listing of files and folders but cannot download a single file The aim is to download several files but atm I can't get anything to work I can upload and download the same files with Filezilla without issue My settings are ftp.PassiveMode=True ftp.TimeoutMs=10000 I am using Net v1.81 I have searched the forums but I cant find anything to shed any light Anyone have a clue as to what is happening here?
Solution S S Smee Apr 5, 2024 Sometimes we don't see what is staring us in the face I had the ServerPathName but neglected to add the filename itself It should have been B4X: Dim sf As Object = ftp.DownloadFile(Starter.ServerPathName & "/filename.csv", True,dir, "Test.csv") Wait For (sf) ftp_DownloadCompleted (ServerPath As String, Success As Boolean) Thank you for your input and help
Sometimes we don't see what is staring us in the face I had the ServerPathName but neglected to add the filename itself It should have been B4X: Dim sf As Object = ftp.DownloadFile(Starter.ServerPathName & "/filename.csv", True,dir, "Test.csv") Wait For (sf) ftp_DownloadCompleted (ServerPath As String, Success As Boolean) Thank you for your input and help
Erel B4X founder Staff member Licensed User Longtime User Apr 4, 2024 #2 550 error code is a permission error. Maybe Filezilla uses different credentials or it is SFTP and not FTP. Upvote 0
550 error code is a permission error. Maybe Filezilla uses different credentials or it is SFTP and not FTP.
S Smee Well-Known Member Licensed User Longtime User Apr 4, 2024 #3 Thanks for the reply Erel I tried to connect using filezilla and SFTP but it wouldn't connect so it's definitely FTP Upvote 0
Thanks for the reply Erel I tried to connect using filezilla and SFTP but it wouldn't connect so it's definitely FTP
Erel B4X founder Staff member Licensed User Longtime User Apr 4, 2024 #4 Try with ftp.UseSSLExplicit = True Upvote 0
S Smee Well-Known Member Licensed User Longtime User Apr 4, 2024 #5 Thanks Erel Sadly that didn't work either Upvote 0
S Smee Well-Known Member Licensed User Longtime User Apr 4, 2024 #6 I have tried with a different FTP site and depending if i use B4X: Dim sf As Object = ftp.DownloadFile(ServerPath False ,Starter.gAppDirectory,"filename.csv") Wait For (sf) ftp_DownloadCompleted (ServerPath As String, Success As Boolean) or B4X: ftp.DownloadFile(ServerPathName, True ,Starter.gAppDirectory,Starter.DataCsv) I get 2 different error messages java.io.EOFException: connection closed and java.lang.RuntimeException: Error retrieving file. 200 Type set to ASCII respectively I can list the files however and filezilla allows me upload and download I have also used all combinations of true and false with no effect I have also tried deleting the file already in the destination path first, nothing seems to work Upvote 0
I have tried with a different FTP site and depending if i use B4X: Dim sf As Object = ftp.DownloadFile(ServerPath False ,Starter.gAppDirectory,"filename.csv") Wait For (sf) ftp_DownloadCompleted (ServerPath As String, Success As Boolean) or B4X: ftp.DownloadFile(ServerPathName, True ,Starter.gAppDirectory,Starter.DataCsv) I get 2 different error messages java.io.EOFException: connection closed and java.lang.RuntimeException: Error retrieving file. 200 Type set to ASCII respectively I can list the files however and filezilla allows me upload and download I have also used all combinations of true and false with no effect I have also tried deleting the file already in the destination path first, nothing seems to work
drgottjr Expert Licensed User Longtime User Apr 4, 2024 #7 ftp error 550 means insufficient permissions OR so such file or folder. we don't know what you have as ServerPathName, so it's hard to know which situation your 550 covers. also, we don't know how you initialized the server. in addition, referring to the other ftp site, you posted: Dim sf As Object = ftp.DownloadFile(ServerPath False ,Starter.gAppDirectory,"filename.csv") Click to expand... this couldn't even compile as you are missing a comma (",") between ServerPath and False also, unless the site is a dedicated ftp site, you could try with okhttputils2 and download like that. is the site also a regular http(s) site? Last edited: Apr 4, 2024 Upvote 0
ftp error 550 means insufficient permissions OR so such file or folder. we don't know what you have as ServerPathName, so it's hard to know which situation your 550 covers. also, we don't know how you initialized the server. in addition, referring to the other ftp site, you posted: Dim sf As Object = ftp.DownloadFile(ServerPath False ,Starter.gAppDirectory,"filename.csv") Click to expand... this couldn't even compile as you are missing a comma (",") between ServerPath and False also, unless the site is a dedicated ftp site, you could try with okhttputils2 and download like that. is the site also a regular http(s) site?
S Smee Well-Known Member Licensed User Longtime User Apr 5, 2024 #8 Thanks for the reply The site(s) are FTP dedicated sites, I have used a regular site, no change As I say I can download ok with an FTP client like filezilla and I see nothin unusual in the settings. The only thing is the site does prefer TLS as per screen shot but will accept clear and anonymous The missing comma is just a typo because I manually changed True to false in that posting so you could see the difference. The compilation does happen, the program runs and lists all files I have uploaded and the folders. The error comes at a download The serverpath Name as supplied by the ftp server is simply "/htdocs". I have tried adding a trailing "/" to the path with no effect Using the serverpathname gives me a full directory listing Any other ideas? Thanks again Upvote 0
Thanks for the reply The site(s) are FTP dedicated sites, I have used a regular site, no change As I say I can download ok with an FTP client like filezilla and I see nothin unusual in the settings. The only thing is the site does prefer TLS as per screen shot but will accept clear and anonymous The missing comma is just a typo because I manually changed True to false in that posting so you could see the difference. The compilation does happen, the program runs and lists all files I have uploaded and the folders. The error comes at a download The serverpath Name as supplied by the ftp server is simply "/htdocs". I have tried adding a trailing "/" to the path with no effect Using the serverpathname gives me a full directory listing Any other ideas? Thanks again
S Smee Well-Known Member Licensed User Longtime User Apr 5, 2024 #9 Sometimes we don't see what is staring us in the face I had the ServerPathName but neglected to add the filename itself It should have been B4X: Dim sf As Object = ftp.DownloadFile(Starter.ServerPathName & "/filename.csv", True,dir, "Test.csv") Wait For (sf) ftp_DownloadCompleted (ServerPath As String, Success As Boolean) Thank you for your input and help Upvote 0 Solution
Sometimes we don't see what is staring us in the face I had the ServerPathName but neglected to add the filename itself It should have been B4X: Dim sf As Object = ftp.DownloadFile(Starter.ServerPathName & "/filename.csv", True,dir, "Test.csv") Wait For (sf) ftp_DownloadCompleted (ServerPath As String, Success As Boolean) Thank you for your input and help