Javascript to Elm

38: Elm File Upload

Informações:

Sinopsis

# 38: Elm File Upload ## Elm File Upload * Setup Interops with fileSelected outgoing * Adding an Outgoing Data type for 'File Selected' and matching case statement for sendData that takes type OutgoingData and returns a Cmd msg * Preventing default * It's seems so easy bc I already know it * Reminding myself about the relearning, deeper learning cycle * onWithOptions, oh boy * Json.Decoder.success - Ignore the JSON and produce a certain Elm value. * wowzer that's a lot * Setup Interops with fileRead incoming * function to read in file using FileReader API * take value and send it back as JSON * decode incoming data and pipe to update function, with pattern match on incoming data case * You need to account for the following values: JSInterop.FileReadImage _ Add a branch to cover this pattern! * Totally always get when I forget to add the pattern match. ### Success ![Preview Image](https://i.imgur.com/NiatiP1.png)       ## Picks ## Resources * [Using Ports with Files](https://www.paramander.com/blog/using-port