B4A Library Automated FTP Library

margret

Well-Known Member
Licensed User
Longtime User
OK, the button is not cut off but the text in the Cancel button is. You need to use this command to set the text size.


This should correct this issue, please let me know how it works.
 

dealsmonkey

Active Member
Licensed User
Longtime User
OK, the button is not cut off but the text in the Cancel button is. You need to use this command to set the text size.



This should correct this issue, please let me know how it works.


It has and thank you again
 

luke2012

Well-Known Member
Licensed User
Longtime User
First of all my compliments for the library!

There is a way to check if a FTP folder already exist ?
 

luke2012

Well-Known Member
Licensed User
Longtime User
Not at the current time. I will look and see if this can be done.

I found I C# function that make this check :

B4X:
public bool directoryExists2(string directory, string mainDirectory)
        {
            try
            {
                var list = this.GetFileList(mainDirectory);
                if (list.Contains(directory))
                    return true;
                else
                    return false;
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                return false;
            }
        }


Do you think that could be ported and integrated in the library ?
 

margret

Well-Known Member
Licensed User
Longtime User
@ luke2012

Please try this new version attached and see if it is working for you. I wrote the code but did not do a lot of testing. Please let me know if you find any issues. The new command works for Files or Folders. If the last parameter is set to TRUE, it will look for folders, if the last parameter is set to FALSE it will look for files. Because the code runs in the background and is modeless you must have a callback sub in the calling module. Code samples below:

B4X:
'Call the command like this:
FTP.FileOrFolderExist("plane.jpg" , "test/files", False)


B4X:
'Callback sub in calling module:
Sub FTP_FileExist(Found As Boolean)
     If Found Then Log("True") Else Log("False")
End Sub

If no issues are found I will update the first post with this version.
 

Attachments

  • Automated FTP Version 1.05.zip
    14.8 KB · Views: 289

Planet

Member
Licensed User
Longtime User
hello,
I tried the version 1.05 sendCMD the command:
the return of the command is

dim ret as string

ret=ftp.sendCMD(...,...) ?

thanks
 

Planet

Member
Licensed User
Longtime User
Hello,
I am attaching a NET documentation.
sorry for my english!
----------------------------------------------------------
SendCommand (Command As String, Parameters As String)
Sends an FTP command. The CommandCompleted event will be raised with the server reply.
Should only be used with commands that return the reply in the command channel (not the data channel).
It is possible that Success will be false and LastException will not be initialized.
Common commands:
MKD - Creates a new folder.
RMD - Deletes an empty folder.
Example:
FTP.SendCommand("MKD", "/somefolder/newfolder")

CommandCompleted (Command As String, Success As Boolean, ReplyCode As Int, ReplyString As String)
 

margret

Well-Known Member
Licensed User
Longtime User
Post #129 is now updated with a newer update of FTP_Auto library. It now includes a way to retrieve the values from the SendCMD function. See sub below:

B4X:
'If you need a return value, you must include this sub below in
'the calling module.
'
Sub FTP_CmdCompleted(Vars() As String)
     Log(Vars(0)) 'Command
     Log(Vars(1)) 'Success
     Log(Vars(2)) 'ReplyCode
     Log(Vars(3)) 'ReplyString
End Sub
 

ernschd

Active Member
Licensed User
Longtime User
Hello Margret,

i use the last version 1.05 of your library for synchronizing files to a FTP-Server.
My problem is when there a no files to download, the upload part never starts.
With files on the FTP everything works fine.

Here's my code:
B4X:
Sub Activity_Create(FirstTime As Boolean)
   FTP.Initialize(Activity, Me, "my-ftp-server", "user", "pass", 21, True, False)   
   downloadFtpFiles
End Sub

Sub downloadFtpFiles
   ftpDown = True   
   If FTP.WiFi_IsConnected Then
     FTP.SetProcessCompleteOn(True)         
     FTP.SetCompletedDownloadDialog(True,"Download erfolgreich")
     FTP.DownloadFileSet(File.DirRootExternal, Array As String("*.new", "*.new"), False)   
  Else
    Msgbox("Message......","Error")
  End If
End Sub

Sub uploadFtpFiles
   ftpDown = False   
   If FTP.WiFi_IsConnected Then
     FTP.SetStealthOn(True)
     FTP.UploadFileSet("/", Array As String(File.DirRootExternal & "/*.db", "*"), False)   
     End If
End Sub

Sub FTP_ProcessComplete
   Log("ftpDown is " & ftpDown)
   If ftpDown = True Then uploadFtpFiles
End Sub

Thank you.
 

s2info

Member
Licensed User
Longtime User
Hello Margret,

Thank You for this lib. The functions deletefile and downloadfile (version 1.05) shows a message box when deletes a file. You could add a parameter (true or false) to show or not show this message box?

Thank You
 

margret

Well-Known Member
Licensed User
Longtime User
Cookies are required to use this site. You must accept them to continue using the site. Learn more…