I'm french, so sorry for my ( so bad ) english ! I need some help, I must do an application who send photo from camera to my wamp server, I try with phonegap, but I've a problem, I try this code but, he says "Done !" ( with my alert ) but I've nothing in my www/PULZ directory Help me please,
function clearCache() {
navigator.camera.cleanup();
}
var retries = 0;
function onCapturePhoto(fileURI) {
var win = function (r) {
clearCache();
retries = 0;
alert('Done!');
}
var fail = function (error) {
if (retries == 0) {
retries ++
setTimeout(function() {
onCapturePhoto(fileURI)
}, 1000)
} else {
retries = 0;
clearCache();
alert('Ups. Something wrong happens!');
}
}
var options = new FileUploadOptions();
options.fileKey = "file";
options.fileName = fileURI.substr(fileURI.lastIndexOf('/') + 1);
options.mimeType = "image/jpeg";
options.params = {}; // if we need to send parameters to the server request
var ft = new FileTransfer();
ft.upload(fileURI, encodeURI("http://192.168.1.22/PULZ"), win, fail, options);
}
function capturePhoto() {
navigator.camera.getPicture(onCapturePhoto, onFail, {
quality: 100,
destinationType: destinationType.FILE_URI
});
}
And my UploadImg.php :
<?php
move_uploaded_file($_FILES["file"]["tmp_name"], './img/');
Thank you for your help ! :)