     (if file
       (update-block-value block-atom :files (conj (vec (:files @block-atom)) (assoc file :key (random-key)))))))
 
+(defn send-file [files-atom block-atom]
+  (let [file (-> (.querySelector js/document (str "#upload-file-" (:key @block-atom)))
+                 .-files
+                 (.item 0))
+        form-data (doto
+                    (js/FormData.)
+                    (.append "file" file (.-name file)))]
+    (m/modal! (file/upload-modal nil (t :file/Uploadingfile) (t :file/Uploadinprogress)))
+    (ajax/POST
+      "/obpv1/file/upload"
+      {:body    form-data
+       :handler (fn [{:keys [status message reason data]} response]
+                  (when (= status "success")
+                    (reset! files-atom (conj @files-atom data))
+                    (select-file block-atom @files-atom (:id data)))
+                  (m/modal! (file/upload-modal status message reason)))})))
+
 (defn remove-file [files-atom file]
   (reset! files-atom (vec (remove #(= % file) @files-atom))))
 

        format (get-in @block-atom [:format] "short")
        sort-by (get-in @block-atom [:sort] "name")
        tagged-badges (->> @badges
                         (filter #(some (fn [t] (= t tag)) (:tags %))))]
    [:div.form-group
     [:div.col-xs-8
      [:div.badge-select

            [salava.core.i18n :as i18n :refer [t]]
            [salava.core.helper :refer [dump]]
            [salava.page.ui.helper :as ph]
            [salava.file.ui.my :as file]
            [salava.file.icons :refer [file-icon]]))

(defn random-key []
