I am trying to upload an image to my FTP.
what i have achieved so far is in this plnkr
My transfer of cordova file looks like
$scope.upload =function(){ var options = { fileKey: "file", fileName: "gopi", chunkedMode: false, mimeType: "image/jpeg", params : {'user_token':' Chandru@123 ', 'user_email':'wepopusers'} // directory represents remote directory, fileName represents final remote file name }; console.log(options); $cordovaFileTransfer.upload('ftp://308.3d8.myftpupload.com/', MyService.getImgPath(), options) .then(function(result) { // Success! console.log(result); console.log("SUCCESS: " + JSON.stringify(result.response)); alert('ftp success'); }, function(err) { // Error console.log(err); alert('ftp fail'); console.log("ERROR: " + JSON.stringify(err)); }, function (progress) { // constant progress updates console.log(progress); }); };
My answer to my error function for cordova file looks like
FileTransferError {code: 2, source: "file: ///storage/sdcard0/Android/data/com.ionicframework.camera108827/cache/1462186990291.jpg", target: " ftp://308.3d8.myftpupload.com/ " , http_status: null, body: null ...} body: nullcode: 2exception: nullhttp_status: nullsource: "file: /// storage / sdcard0 / Android / data / com. ionicframework.camera108827 / cache / 1462186990291.jpg" target: " ftp://308.3d8.myftpupload.com/ " proto : object
I have a TakePicture button that will display a pic and show to the user, and also I have a function to load using cordovafiletransfer $ scope.upload .
My ftp host ftp://308.3d8.myftpupload.com/ username and password are in my encoding. I have the name of the gopi folder where my image should be stored.
my path to the selected image is in the imageURI parameter, so I used services to set the path.
I'm confused steps
1) I cannot understand the var options object in the cordova file transfer plugin.
2) I do not get any erro when remote debugging, but I only raise my funtion error in my cordova file transfer.
How to update captured image on FTP using IONIC
UPDATE
Thanks gandhi, answer https://github.com/xfally/cordova-plugin-ftp how I managed to connect to ftp without multipart.
but in this
$ window.cordova.plugin.ftp.upload ("/ ping", "/ gopi / ping", function (percent) {
I do not know what to do in the first argument and in the second.
$ window.cordova.plugin.ftp.upload ("/default.prop", "/gopi/default.prop", function (%) {
The above line success is completely sent to my ftp, but I cannot post my image, which is stored in my ping variable.
https://plnkr.co/edit/ETGmdl4B0d5dlHWdJQ9m?p=info