Installed

elm/browser
1.0.2
elm/core
1.0.5
elm/file
1.0.5
elm/html
1.0.0
elm/json
1.1.3

Registry

elm/http
2.0.0
elm/random
1.0.0
elm/time
1.0.0
elm/svg
1.0.1
evancz/elm-playground
1.0.3
elm-explorations/webgl
1.1.3
w0rm/elm-physics
5.1.3
rtfeldman/elm-css
18.0.0
mdgriffith/elm-ui
1.1.8
​x
        , on "change" (D.map GotFiles filesDecoder)
 
1
-- File upload with the <input type="file"> node.
2
--
3
-- Dependencies:
4
--   elm install elm/file
5
--   elm install elm/json
6
--
7
​
8
​
9
import Browser
10
import File exposing (File)
11
import Html exposing (..)
12
import Html.Attributes exposing (..)
13
import Html.Events exposing (..)
14
import Json.Decode as D
15
​
16
​
17
​
18
-- MAIN
19
​
20
​
21
main =
22
  Browser.element
23
    { init = init
24
    , view = view
25
    , update = update
26
    , subscriptions = subscriptions
27
    }
28
​
29
​
30
​
31
-- MODEL
32
​
33
​
34
type alias Model = List File
35
​
36
​
37
init : () -> (Model, Cmd Msg)
38
init _ =
39
  ([], Cmd.none)
40
​
41
​
42
​
43
-- UPDATE
44
​
45
​
46
type Msg
47
  = GotFiles (List File)
48
​
49
​