2
Hello I have the following code
onDeviceReady: function () {
navigator.camera.getPicture(
app.uploadPhoto,
function (message) { alert('get picture failed'); },
{
quality: 50,
destinationType: navigator.camera.DestinationType.FILE_URI,
sourceType: navigator.camera.PictureSourceType.PHOTOLIBRARY
}
);
},
uploadPhoto: function(imageURI) {
var options = new FileUploadOptions();
options.fileKey="file";
options.fileName=imageURI.substr(imageURI.lastIndexOf('/')+1);
options.mimeType="image/jpeg";
var params = {};
params.value1 = "test";
params.value2 = "param";
options.params = params;
var ft = new FileTransfer();
ft.upload(imageURI, encodeURI("http://192.168.0.101/upload/index.php"), app.win, app.fail, options);
},
win: function(r) {
console.log("Code = " + r.responseCode);
console.log("Response = " + r.response);
console.log("Sent = " + r.bytesSent);
},
fail: function(error) {
alert("An error has occurred: Code = " + error.code);
console.log("upload error source " + error.source);
console.log("upload error target " + error.target);
},
It is working, however when I upload to my php I do not know how to save, my php is like this:
<?php
move_uploaded_file($_FILES["file"]["tmp_name"], 'C:\xampp\htdocs\upload\images');
?>
I’d like to save inside C:\xampp\htdocs\upload\images
, how my php should look?
If your answer is correct, then mark it as accepted.
– durtto