If I understand correctly your want to upload a file from the client machine to the web application using the standard HTML tag <input type="file"> and then hash the
content of the file.
Your code is actually hashing the full path of the file.
If you want to read the content of a file, I recommend to use FileReader like this:
If web3 is not defined as a global variable, but you have "web3 = new Web3(web3.currentProvider)" inside a function - the web3 object will be local for that function only, while with window.web3 it will be globaly accessible