file-upload in re-frame/reagent

1,532 views
Skip to first unread message

Jamie Orchard-Hays

unread,
Apr 28, 2015, 2:39:02 PM4/28/15
to clojur...@googlegroups.com
Wondering what's the simple, canonical way to do file-upload in re-frame/reagent.

Cheers,

Jamie

Oliver George

unread,
Apr 29, 2015, 3:49:44 AM4/29/15
to clojur...@googlegroups.com
I can't speak with authority but here's some (quite fresh and untested) code from our Om project.  

Nice things (thanks to google closure library)
  • drag/drop support
  • POST doesn't reload page


--
Note that posts from new members are moderated - please be patient with your first post.
---
You received this message because you are subscribed to the Google Groups "ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojurescrip...@googlegroups.com.
To post to this group, send email to clojur...@googlegroups.com.
Visit this group at http://groups.google.com/group/clojurescript.



--
Oliver George
Director, Condense
0428 740 978

Jamie Orchard-Hays

unread,
Apr 29, 2015, 9:03:19 AM4/29/15
to clojur...@googlegroups.com
To answer my own question:

view:

[:input {:type "file" :id "file" :name "file"
:on-change
#(dispatch [:save-rm-file :file (-> % .-target .-files (aget 0))])}]

in the handler:
(http/put url {:multipart-params {k file}})...

Jamie
Reply all
Reply to author
Forward
0 new messages