I know this is an old thread, but I came across the same issue today, I
ended up with something like:
(POST "/upload" request
(multipart/wrap-multipart-params
(fn [{{file "file"} :params}]
(handle-updload file))))
Sebastián
On Friday, April 4, 2014 at 2:39:23 AM UTC-3, K Livingston wrote:
>
> I'm trying to dynamically handle the InputStream in file uploads
> (ring/compojure app via servlet/jetty). I started with two different
> versions of the wrap-multipart-params, one is basically a NoOp that just
> returns the file name, and the other echoes the file back. They both work
> fine independently but when I try to bring them both online together, which
> ever store is defined first is the one I see called regardless of handler.
>
> Can I only have one copy of wrap-multipart-params in the whole app?
>
> How can I change how the InputStream is handled depending on the handler?
>
> Do I need to just have the handler return the IO stream and then change
> the behavior in each handler function?
>
> example:
> The logging store is called even with POST to /upload-echo. The echo
> store is never called.
>
> (defroutes file-list-routes
> (GET "/list-content" request (file-list/show-file-list request))
>
> (GET "/upload-logging" request
> (upload/simple-upload-file "upload-logging" request))
> (mp/wrap-multipart-params
> (POST "/upload-logging" request (upload/upload-logging-file request))
> {:store upload/logging-store})
>
> (GET "/upload-echo" request
> (upload/simple-upload-file "upload-echo" request))
> (mp/wrap-multipart-params
> (POST "/upload-echo" request (upload/upload-echo-file request))
> {:store upload/echo-store})
>
> );end route list
>
> These routes are then nested into some other context calls and of course
> other middleware, until eventually making it up to the servlet. There are
> no other calls to wrap-multipart-params in my application.
>
> Thanks for your help,
> Kevin
>
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
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 [email protected].
For more options, visit https://groups.google.com/d/optout.