NxTIC/view/js/input.js

18 lines
383 B
JavaScript

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