Strange problems with the FTP library

vecino

Well-Known Member
Licensed User
Longtime User
Hello, I am trying to download zip files by FTP and then decompress them to import them. I'm finding several problems it seems that the culprit is the library FTP, the files are downloaded defective, damaged, although if the files are tiny then I usually download well.
I thought the problem was the unzip (Archiver library), but it seems that the problem is before, downloading via FTP.
The topic was being trying in this thread.

Thank you very much to anyone who can help me.
Greetings.
 

vecino

Well-Known Member
Licensed User
Longtime User
Hi, sorry for the delay, I have not received email notice.

I replaced the names of variables and I cut the code to leave only what affects the FTP.

A few hours returned to work well, however, in recent tests has not worked well.

Thanks for the help.
Greetings.

B4X:
Sub Globals
  Dim FTP, FTPfotos As FTP
End Sub

Sub FTP_ListCompleted (ServerPath As String, Success As Boolean, Folders() As FTPEntry, Files() As FTPEntry)  
  If Success = False Then
    Log(LastException)
  Else
    FTP.DownloadFile( "mftp/dat01001.zip", false, File.DirInternal&"/import", "dat01001.zip" )                                    
  End If   
End Sub

Sub FTP_DownloadProgress (ServerPath As String, TotalDownloaded As Long, Total As Long)
  DoEvents
End Sub

Sub FTP_DownloadCompleted (ServerPath As String, Success As Boolean)  
  If Success = False Then 
    Log(LastException.Message)   
  else   
    Dim zz As Archiver
   zz.AsyncUnZip(File.DirInternal&"/import/","dat01001.zip", File.DirInternal&"/import/", "zz")
  End If   
End Sub

Sub zz_UnZipDone(CompletedWithoutError As Boolean, NbOfFiles As Int)   
  ProcesarDatos
End Sub         

Sub zz_UnZipProgression(Count As Int, FileName As String)
  ' Log("< "&Count&" "&FileName&" >")
End Sub

Sub btImportar_Click            
  If FTP.IsInitialized Then FTP.CloseNow      
  FTP.Initialize("FTP", "ftp.drivehq.com", 21, "auser", "apassword")
  FTP.PassiveMode = true
  FTP.List( "/" )   
End Sub
 

vecino

Well-Known Member
Licensed User
Longtime User
Hello, I think I found the problem. I created a new account and now works correctly.
I have also played with the FTP parameters.
Tomorrow I'll do more testing, I will keep you informed.
I think I now see the light at the end of the tunnel.
Thanks and regards
 

vecino

Well-Known Member
Licensed User
Longtime User
Hello, thank you very much for the information, very useful.

By the way, I think the problem "ftp" is solved by creating another account. Currently, it works correctly.

Thanks and regards.
 

vecino

Well-Known Member
Licensed User
Longtime User
Hello, I think I've discovered the problem.
The problem was that he had put a variable with the value "true" to "ascii":
B4X:
FTP.DownloadFile (cPathFile, bAscii, cDir, cFilezip)
The variable "bAscii" had the value "true"

I'm sorry, sorry for the inconvenience

Thanks for your patience.
Greetings.
:sign0013:
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…