As stated by RedGrittyBlock this is really more of a web development question vs a bitcoin one. Also although it can be fun to create keys from file sources, typically it's a bad idea and should be more of a learning exercise than for actual use. To that end you should look at the built-in FileReader() API if you are seeking a simple javascript solution.
For example if you were doing a drag-drop to capture the file
holder.ondrop = function(event) {
event.preventDefault();
var file = event.dataTransfer.files[0];
var reader = new FileReader();
reader.onload = function(event) {
var binary = event.target.result;
//Do whatever you want with the data, sha256 hash it, etc
//var mnemonic = bip39.entropyToMnemonic(binary);
};
reader.readAsBinaryString(file);
};
Source