# How to handler-test file uploads?

**URL:** https://clojureverse.org/t/how-to-handler-test-file-uploads/6310
**Category:** How to?
**Tags:** webapps
**Created:** [July 29, 2020, 4:42pm UTC](https://clojureverse.org/t/how-to-handler-test-file-uploads/6310 "2020-07-29T16:42:47Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Webdev\_Tory](https://clojureverse.org/user_avatar/clojureverse.org/webdev_tory/32/3781_2.png) [@Webdev\_Tory](https://clojureverse.org/u/Webdev_Tory)
#### Post date: [July 29, 2020, 4:42pm UTC](https://clojureverse.org/t/how-to-handler-test-file-uploads/6310/1 "2020-07-29T16:42:48Z")

</div>

In the past when I’ve done generic file uploads through a browser, it gets ring-interpreted into the `[:params :file]` path. Has anyone had success writing unit tests for the handler of such a route? Should I just write my own mock request map like:

```clojure
{:params {:file {:filename "file.mp4"
		 :content-type "media/mp4"
		 :tempfile (java.io/File. "/tmp/test.mp4")}}}

```

---

<div class="post-metadata">

### Author: ![system](https://clojureverse.org/uploads/default/original/2X/5/51079bf9e4b7d9466242c06cf1e43b9f8bd6da14.png) [@system](https://clojureverse.org/u/system)
#### Post date: [January 28, 2021, 4:42am UTC](https://clojureverse.org/t/how-to-handler-test-file-uploads/6310/2 "2021-01-28T04:42:48Z")

</div>

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.
