I've not used it yet, but there's a module for doing that here:

https://github.com/simonh1000/file-reader

Note you have to enable native modules in your config, and you can't just
install it as a package as Elm packages don't allow native code.

On Sat, Nov 5, 2016 at 8:27 AM, Martin DeMello <martindeme...@gmail.com>
wrote:

> I'm a bit lost trying to put the pieces together for this. I have a web
> service that does file format conversion, and I want to use the
> binary->json converter to import a binary file into an elm frontend.
>
> Here's some code to illustrate what I want to achieve. I can call my
> webapp via
>
> $ curl --form "filedata=@filename.bin" --form "from=binary" --form
> "to=json" http://localhost:1234/json
>
> and in my view I have
>
>   form [class "pure-form", id "convert-form"]
>   [ fieldset []
>       [ input [ type' "file" , class "pure-button"] []
>       , a [class "pure-button", onClick UploadFile] [text "Load"]
>       ]
>   ]
>
> From what I can tell, I'll need to go through the ports system both to
> upload the file and to attach the binary data to a POST request, but I'm
> not too familiar with javascript either, and I'm hoping this is something
> someone has already figured out for their own app.
>
> martin
>
> --
> 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 elm-discuss+unsubscr...@googlegroups.com.
> 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 elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to