Fork me on GitHub
#clj-http
<
2021-08-12
>
wei07:08:28

I'm trying to do a multipart file upload of a directory. Here's my request:

(let [files (->> (file-seq (io/file path)) (map io/file)
                 (filter #(.exists %))
                 (remove #(.isDirectory %)))]
  (http/post (str ENDPOINT "/add")
             {:as :json 
              :multipart (concat
                          [{:name "file"
                            :filename "assets/cards/metadata/small"
                            :mime-type "application/x-directory"
                            :content (io/file "assets/cards/metadata/small")}]
                          (map 
                           (fn [f]
                             {:name "file"
                              :filename (.getPath f)
                              :content f})
                           files))}))
getting the error
Execution error (FileNotFoundException) at java.io.FileInputStream/open0 (FileInputStream.java:-2). assets/cards/metadata/small (Is a directory). 
but if I remove the directory section, only the first file in the directory gets uploaded. any tips on how to troubleshoot this?