如何将Android联系人的照片发送到我的服务器?
我正在使用cordova 2.9.0
var file = 'content://com.android.contacts/contacts/1/photo';
Camera.DestinationType.DATA_URL = file;
navigator.camera.getPicture(function(imageURI){
var options = new FileUploadOptions();
options.fileKey="file";
options.fileName = imageURI.substr(imageURI.lastIndexOf('/') + 1);
options.mimeType="image/jpeg";
var params = {};
params.uid = device.uuid;
options.params = params;
var ft = new FileTransfer();
ft.upload(imageURI, encodeURI(this.server + '/upload.php'), function(r){
console.log("Code = " + r.responseCode);
console.log("Response = " + r.response);
console.log("Sent = " + r.bytesSent);
}, function(error){
alert("An error has occurred: Code = " + error.code);
console.log("upload error source " + error.source);
console.log("upload error target " + error.target);
}, options);
}, function(){ console.log('file fail'); }, {
destinationType: Camera.DestinationType.DATA_URL,
sourceType: Camera.PictureSourceType.PHOTOLIBRARY,
correctOrientation: true
});