NxTIC/view/js/input.js

18 lines
395 B
JavaScript

var fileInput = document.querySelector('input[type=file]');
fileInput.addEventListener('change', function(e){
/* (1) On rédige la requête */
var uploadRequest = {
path: 'upload/call_log',
file: fileInput.files[0]
};
/* (2) On effectue l'upload (import) */
api.send(uploadRequest, function(response){
console.log( response );
});
}, false);