-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathftpupload.js
44 lines (34 loc) · 1.24 KB
/
ftpupload.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/**
* Plugin ftpupload
*
* Copyright (c) 2013 Gokce Taskan
*
**/
/* Get local ref to global PhoneGap/Cordova/cordova object for exec function.
- This increases the compatibility of the plugin. */
var cordovaRef = window.PhoneGap || window.Cordova || window.cordova; // old to new fallbacks
function FtpUpload() {
this.resultCallback = null; // Function
}
FtpUpload.prototype.sendFile = function(successCallback, failCallback, address, username, password, file) {
var args = {};
if(address)
args.address = address;
if(username)
args.username = username;
if(password)
args.password = password;
if(file)
args.file = file;
return cordovaRef.exec(successCallback, failCallback, "FtpUpload", "sendFile", [args]);
}
cordovaRef.addConstructor(function() {
if(!window.plugins) {
window.plugins = {};
}
// shim to work in 1.5 and 1.6
if (!window.Cordova) {
window.Cordova = cordova;
};
window.plugins.ftpUpload = new FtpUpload();
});