What did the trick for me was:
- Define an hiden input in elm with type file(So you are not able to use it as a user)
- I have defined an onchange function also in the elm side that will allo me to know which file was selected if any
- Registering a port function that when invoked trigers the click behaviour of the hidden input
- Register onchange callback on the javascript side on the same input object defined in the elm side
- when the file changes I calculate in the javascript side the hash of the file using the crypto-js/sha256
- using a port I send back the value calculater in the javascript side.