Thanks.  This is indeed what was going on.  I even went checking for that 
middle ware being referenced somewhere else, but didn't realize that 
handler function was adding so much middle ware (didn't even bother looking 
in it).

I removed the double calls and things are performing exactly as I expect 
now.

thanks,
Kevin


On Tuesday, April 1, 2014 12:38:56 PM UTC-6, James Reeves wrote:
>
> It's because you apply wrap-multipart-params twice. First with the default 
> arguments, then with your custom store. The first application of the 
> function is via compojure.handler/site. If you remove that, or use 
> handler/api instead, or apply the parameter middleware yourself, your code 
> should work as expected.
>
> - James
>
>
> On 1 April 2014 19:15, K Livingston <kevinliving...@gmail.com<javascript:>
> > wrote:
>
>> Sorry, I just realized there's a ring-specific mailing list - apologies 
>> for the clutter.
>> Moved:
>> https://groups.google.com/d/topic/ring-clojure/O5HoT-UIWfk/discussion
>>
>>
>> On Tuesday, April 1, 2014 12:02:26 PM UTC-6, K Livingston wrote:
>>>
>>> I'm having trouble using a custom :store with multipart-params.  I 
>>> thought I did exactly what the documentation indicates, but I'm getting the 
>>> default behavior.
>>>
>>> http://ring-clojure.github.io/ring/ring.middleware.multipart-params.html
>>>
>>>  :store    - a function that stores a file upload. The function should
>>>               expect a map with :filename, content-type and :stream keys,
>>>               and its return value will be used as the value for the
>>>               parameter in the multipart parameter map. The default storage
>>>               function is the temp-file-store.
>>>
>>>
>>>
>>> (mp/wrap-multipart-params 
>>>    (POST "/upload-x" request (upload/upload-file request))
>>>    {:store upload/logging-store})
>>>
>>> My logging store function looks like this (it's just a dummy for now - 
>>> eventually I want to handle the stream in a custom way) None of that IO 
>>> happens.
>>>
>>> (defn logging-store [{filename     :filename
>>>                       content-type :content-type
>>>                       stream       :stream
>>>                       :as params}]
>>>   (println "in logging store")
>>>   (pprint filename)
>>>   (pprint params)
>>>   filename)
>>>
>>> upload-file looks like this:
>>>
>>> (defn upload-file [{params :params
>>>                     session :session :as request}]
>>>   (let [user-id (:user-id session)
>>>         files (get params "files")]
>>>     (pprint request)
>>>     (pprint params)
>>>     (response/response
>>>      {:status    :success})))
>>>
>>> The printing for the request and the params clearly show the multipart 
>>> params in there and that they are being handled by the temp file store:
>>>
>>>  :multipart-params
>>>  {"files"
>>>   {:size 1674,
>>>    :tempfile
>>>    #<File 
>>> /var/folders/rx/9ntjyyvs35qbmcbp6rhfmj200000gn/T/ring-multipart-3853352501927893381.tmp>,
>>>    :content-type "application/octet-stream",
>>>    :filename "blog-test.clj"}},
>>>
>>>
>>>
>>> cross post here (if you want stack overflow points):
>>> http://stackoverflow.com/questions/22792577/using-a-
>>> custom-store-with-wrap-multipart-params-in-ring-middle-ware
>>>
>>  -- 
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clo...@googlegroups.com<javascript:>
>> Note that posts from new members are moderated - please be patient with 
>> your first post.
>> To unsubscribe from this group, send email to
>> clojure+u...@googlegroups.com <javascript:>
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "Clojure" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to clojure+u...@googlegroups.com <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to