-3
I’m creating a survey app with javascript or jquery.
The app saves everything inside the phone itself, to then be sent to the server, because it doesn’t always have good internet signal.
Example of saved data:
Question:
How to upload the file from the file, since I only have the link from where it was saved?
I thank everyone who can help me.
Code:
function upsync() {
db.transaction(function (tx) {
tx.executeSql('SELECT ID, id_ar, id_ambiente, foto, obs FROM vistorias_fotos WHERE id_ar=?', [id_ar], function (tx, resultado) {
let rows = resultado.rows;
for (var i = 0; i < rows.length; i++) {
$.ajax({
type: "POST",
url: "https://testes.musite.net/app/up_vistorias.php",
data: {acesso: 'ok',
id_ar: rows[i].id_ar,
id_ambiente: rows[i].id_ambiente,
foto: rows[i].foto, //-> file:///storage/emulated/0/Android/data/br.com.nomedoapp.app/cache/1578505903880.jpg
obs: rows[i].obs,
},
success: function(data) {
if (data == 'ok'){
alert('Dados enviado ao MySQL');
}
}
});
}
});
});
}