I struggle for a few days to do this. Without success.
I found two ways that I think should reasonably follow:
1: plug-in cordova-sftp-plugin.
I see that this is due to "secure ftp", but why not work in normal insecure ftp? Nothing was said about this.
I tried it this way, using the "Use example" on the official page, the code falls into the success callback function, but when I listed the local directory, nothing changed! This does not let me know what is going wrong! In fact, the software does not detect anything bad.
Before the previous steps, I did not forget to pre-install and enable "cordova-plugin-file", "cordova-plugin-file-transfer" and "cordova-plugin-network-information" and add <lt; use-permission android: name = "android.permission.WRITE_EXTERNAL_STORAGE" /> in AndroidManifest.xml. Attempting to save files to cordova.file.externalRootDirectory and cordova.file.externalRootDirectory + "/ Downloads /. Nothing worked.
2. Plugin macdonst FtpClient.
Finding my problem, one of the first pages to appear. How do I transfer the ftp file to the server using PhoneGap / webapp? , and also beyond the scope of my further search I found another one in a relatively old post, mentioned about the successful use of this plugin in the Cordoba application. Therefore, I can consider this plugin as a stable choice.
The problem with this method comes earlier: I donβt even create an application after doing a manual installation. Perhaps this is a problem in the manual installation process.
The official documentation of the plugin teaches you to install it in the PhoneGap application, and not in Cordoba. The steps were not reproduced in Cordoba due to some differences in the tracks and configuration, and some other links also support installing the plugin exclusively in Phonegap and not in Cordoba.
I also tried to follow the steps in http://antonylees.blogspot.com.br/2015/01/how-to-manually-add-cordova-plugins-to.html and Manually install the device plugin (and others) in cordova 3.0 . to manually add the plugin. The steps in the first link were also not well reproduced, and although the second of them is more complicated, the problem is also not resolved.
Building this gives me a compilation of java errors. The first error output (which leads to all of the following errors):
E:\danilo\Documentos\projetos_cordova\ftpDownload3\platforms\android\src\com\phonegap\plugins\ftpclient\FtpClient.java:27: error: package org.apache.cordova.api does not exist import org.apache.cordova.api.CallbackContext;
Very strange. Can I find the org.apache.cordova.api jar file and put it in the lib folder? In addition, I did not forget to put the commons-net-2.2.jar file in the libs project folder.
Does anyone have a suggestion to do this? I just want to upload the file via ftp protocol and save locally, and therefore, if there is an alternative method for success, it will also be appreciated.
Thanks in advance.