# Sending a File through a port

**URL:** <https://discourse.elm-lang.org/t/sending-a-file-through-a-port/3440>\
**Category:** Learn\
**Created:** [April 5, 2019, 1:49pm UTC](https://discourse.elm-lang.org/t/sending-a-file-through-a-port/3440 "2019-04-05T13:49:23Z")\
**Posts on this page:** 1\
**Showing post:** 11

<div class="post-metadata">

**Author:** ![pdamoc](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/pdamoc/32/36_2.png) [@pdamoc](https://discourse.elm-lang.org/u/pdamoc)\
**Post date:** [April 5, 2019, 11:18pm UTC](https://discourse.elm-lang.org/t/sending-a-file-through-a-port/3440/11 "2019-04-05T23:18:56Z")

</div>

> [@Dan\_Abrams](#):
>
> Can we encode an opaque type as a value? How do we get the fileRef on the elm side?

You use a custom event handler on an `input`. It would look [like this](https://ellie-app.com/5bnxKMFYzwka1). You can then use the FileRef to send the file where it needs to get using your preferred JS method. .

---

_[View the full topic](https://discourse.elm-lang.org/t/sending-a-file-through-a-port/3440)._
