Skip to content

Instantly share code, notes, and snippets.

@lbradstreet
Last active August 29, 2015 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lbradstreet/48d6c61e0a8eb533232a to your computer and use it in GitHub Desktop.
Save lbradstreet/48d6c61e0a8eb533232a to your computer and use it in GitHub Desktop.
multipart upload
[:div
[:b "Now that you've submitted your message, you can upload an image of your own, or read the messages"]
[:form.form-horizontal {:action "/upload" :method "post" :encType "multipart/form-data"}
[:div.form-group
[:input.form-control {:name "file"
:on-change (fn [e] (om/set-state! owner :can-upload-image true))
:type "file"
:size "20"}]
[:label.control-label "Who are you?"]
[:input.form-control {:name "person"}]
[:label.control-label "Image description:"]
[:input.form-control {:name "description"}]
[:button.btn.btn-success.form-control
{:type "submit"
:class "btn success"
:bs-style "success"
:on-click (fn [e]
(let [confirm-result (js/confirm (str "Note, this will clear any words you have written"
" wishing Ling happy birthday! Please confirm!"))]
(if (and can-upload-image?
confirm-result)
(do (om/set-state! owner :upload-image nil)
true)
false)))
:name "submit"}
"Submit"]]]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment