Skip to content

Instantly share code, notes, and snippets.

@noherczeg
Created February 27, 2018 12:26
Show Gist options
  • Save noherczeg/334a017249b7aeb447daed3e05063f16 to your computer and use it in GitHub Desktop.
Save noherczeg/334a017249b7aeb447daed3e05063f16 to your computer and use it in GitHub Desktop.
$(document).on('change', '#clientupload', function () {
var x = document.getElementById("clientupload");
if ('files' in x) {
if (x.files.length > 0) {
//only one file accepted
for (var i = 0; i < 1; i++) {
var myFile = x.files[0];
var reader = new FileReader();
reader.readAsText(myFile);
reader.onload = function () {
window.sessionStorage.setItem(STORAGE_KEY, reader.result);
$('#clientId').val(null);
$('#reset-file').show();
}
}
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment