Como subir un fichero desde cordova con file transfer
$('.take-foto').on('click',function(){ var options = { encodingType: 0, quality: 60, destinationType: Camera.DestinationType.FILE_URI, correctOrientation: true, targetWidth: 4000, targetHeight: 3000 }; navigator.camera.getPicture(uploadFileTransfer, onFailCamara, options); })
function uploadFileTransfer(imageURI){ winUpload = function(r){ var data = JSON.parse(r.response); // Si la respuesta del servidor es json console.log(data); // navigator.camera.cleanup(function(){},function(){}); }; failUpload = function(error){ console.log(error) // navigator.camera.cleanup(function(){}, function(){}); }; var options = new FileUploadOptions(); options.fileKey = "photo"; options.fileName = imageURI.substr(imageURI.lastIndexOf('/') + 1); options.mimeType = "image/jpeg"; //Parametros para pasar cuando se sube la foto var params = {}; params.uploadFotoEntSal = 1; options.params = params; var ft = new FileTransfer(); ft.upload(imageURI, encodeURI(_url_), winUpload, failUpload, options); }