The Elm interface to the file-listener custom element.
This code won't do anything unless site/js/file-listener.js is loaded.
Convenience type.
The custom file-listener element.
It's invisible, but it adds an event listener to the asociated <input type='file' id='fileId' /> element to fetch the contents of the file, and generate a "load" event containing the contents and other information.
Create a input element of type file with the given Id and the first list of attributes.
Connect a file-listener element to it, with the second list of attributes.
All bundled up in an enclosing span element.
You need to set the fileId attribute to the id of an input of type file.
Not necessary if you use fileInput to create the two elements, since it will connect the file-listener element to the input element for you.
This is how you receive file content and other information.
Turn a boundary string into a multipart/form-data mime type.
This is suitable as the first parameter to Http.stringBody.
Turn a boundary string and a File into the body of a multipart form post.
This is suitable as the second parameter to Http.stringBody.
Two-character string: carriage return, line feed
onLoadreceives aFileinstance from the JS code.datais a binary string, containing the file contents.dataUrlis adata:URL that you can use as thesrcof animgelement to display the image.