Permalink
Please sign in to comment.
Showing
with
24 additions
and 1 deletion.
13
ring-core/src/ring/middleware/multipart_params.clj
12
ring-core/src/ring/middleware/multipart_params/temp_file.clj
| @@ -0,0 +1,12 @@ | ||
| +(ns ring.middleware.multipart-params.temp-file | ||
| + (:require [clojure.java.io :as io]) | ||
| + (:import java.io.File)) | ||
| + | ||
| +(defn temp-file-store | ||
| + "Stores multipart file parameters as a temporary file." | ||
| + [item] | ||
| + (let [temp-file (File/createTempFile "ring-multipart-" "")] | ||
| + (with-open [out (io/output-stream temp-file)] | ||
| + (io/copy (:stream item) out)) | ||
| + (-> (select-keys item [:filename :content-type]) | ||
| + (assoc :temp-file temp-file)))) |
0 comments on commit
192862d