I am using the same documentation code. , but when I send to PHP, there is no file.
JS
function uploadPhotoRevendedor(imageURI) {
var success = function (r) {
app.alert("Code = " + r.responseCode + "Response = " + r.response + "Sent = " + r.bytesSent);
}
var fail = function (error) {
app.alert("An error has occurred: Code = " + error.code + "Source = " + error.source + "Target = " + error.target);
}
var options = new FileUploadOptions();
options.fileKey = "file";
options.fileName = imageURI.substr(imageURI.lastIndexOf('/')+1);
options.mimeType = "image/jpeg";
// Upload image
var ft = new FileTransfer();
ft.upload(imageURI, encodeURI(...'model/foto-revendedor.php'), success, fail, options);
}
PHP
print_r(json_encode($_FILES));
$new_image_name = urldecode($_FILES["file"]["name"]).".jpg";
$result = move_uploaded_file($_FILES["file"]["tmp_name"], "../users/".$new_image_name);
The http code returns 200 OK in the success function but $ _FILES appears empty ...