I followed this link for FTP upload : https://github.com/gokce/phonegap-ios-plugin-ftpupload. I am able to upload the file on ftp but every time weather its a success or error its going to CDVpluginResult.m file On success its going to this function
- (NSString*)toSuccessCallbackString:(NSString*)callbackId
and on error its going to this function
- (NSString*)toErrorCallbackString:(NSString*)callbackId
So i want to return this success or error to javascript can anyone help me?
Following is the snippet from where i am returning success or error
- (void) returnSuccess {
NSMutableDictionary* posError = [NSMutableDictionary dictionaryWithCapacity:2];
[posError setObject: [NSNumber numberWithInt: CDVCommandStatus_OK] forKey:@"code"];
[posError setObject: @"Success" forKey: @"message"];
CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:posError];
if (callbackId) {
[self writeJavascript:[result toSuccessCallbackString:callbackId]];
}
It comes here after success or error..
- (NSString*)toSuccessCallbackString:(NSString*)callbackId
here i want to show the status whether its a success or error
function upload(){
var args = {};args.address = " ";args.username = "";args.password = "";args.file = path;
cordova.exec(successCallback, failCallback, "FtpUpload", "sendFile", [args]);}
function successCallback(data){
alert('successCallback' + data);}
function failCallback(data){
alert('failCallback' + data);
Plz Help me!!
One common mistake is to forget including the plugin. You should read the docs carefully again. Plus, read the instructions that I provided. Though be warned that I am not maintaining the code so it might not work with later PhoneGap versions.
Don't use
cordova.exec(successCallback....
for calling the plugin. Instead call it like this:
window.plugins.ftpUpload.sendFile(successCallback, failCallback, "address", "username", "password", "filepath");
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments