> I did actually try using decoders first to pull in the "e.target.files" property as a Value, but Elm just fails to decode it.
How did you try to decode the "files"? There is a special function: value -> Decoder Value it does leave the structure "as is". I was wandering if it could work? The original "files" could be then assigned to the body, so Elm would not touch it at all. Would it possibly work? Regards, Witold Szczerba 05.05.2017 7:32 PM "Kasey Speakman" <[email protected]> napisaĆ(a): > After a bit of research on file uploads, I pared it down to the simplest > method I could find. Here is the recipe I came up with. > > https://gist.github.com/kspeakman/20708d5ff58b6ea75f9c3a82f6c793c3 > > The FileUtils module essentially wraps the JS File object in Http.Body as > well as exposing common file info (name, size, contentType). Using > Http.Body makes it quite easy to send files with normal Http calls. > Unfortunately this does use native/kernel code, but this made it far easier > to work with in Elm than if I used ports. I did actually try using decoders > first to pull in the "e.target.files" property as a Value, but Elm just > fails to decode it. > > I also thought something like this could be a path forward to introduce > basic file uploads into Elm's core. It is not a general solution for all > binary formats. But it is a straightforward way to handle File objects from > JS. > > -- > You received this message because you are subscribed to the Google Groups > "Elm Discuss" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Elm Discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
