# Web App File Uploading

**URL:** <https://discourse.julialang.org/t/web-app-file-uploading/25370>\
**Category:** Web Stack\
**Tags:** web, webapps\
**Created:** [June 17, 2019, 3:07pm UTC](https://discourse.julialang.org/t/web-app-file-uploading/25370 "2019-06-17T15:07:11Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![versipellis](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/versipellis/32/7878_2.png) [@versipellis](https://discourse.julialang.org/u/versipellis)\
**Post date:** [June 17, 2019, 3:07pm UTC](https://discourse.julialang.org/t/web-app-file-uploading/25370/1 "2019-06-17T15:07:11Z")

</div>

I spent the last few weeks building out a pure-Julia webapp for exploratory data analysis in WebIO + Blink + Interact, and recently switched over to WebIO + Mux + Interact as I wanted to deploy it rather than being an Electron app. To my chagrin, I found out that `filepicker` in Interact.jl only works with Blink, not Mux, because it’s handled as a reference to the local filesystem.

Does anyone have suggestions for implementing an “upload file” functionality that ties in with the Julia backend?

---

<div class="post-metadata">

**Author:** ![pfitzseb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pfitzseb/32/45566_2.png) [@pfitzseb](https://discourse.julialang.org/u/pfitzseb)\
**Post date:** [June 17, 2019, 3:35pm UTC](https://discourse.julialang.org/t/web-app-file-uploading/25370/2 "2019-06-17T15:35:02Z")

</div>

A [plain HTML form](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file) seems like the most straightforward solution.

---

<div class="post-metadata">

**Author:** ![versipellis](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/versipellis/32/7878_2.png) [@versipellis](https://discourse.julialang.org/u/versipellis)\
**Post date:** [June 17, 2019, 4:12pm UTC](https://discourse.julialang.org/t/web-app-file-uploading/25370/3 "2019-06-17T16:12:27Z")

</div>

Initially, I thought a [custom HTML5 file input widget](https://juliagizmos.github.io/Interact.jl/latest/widgets/#HTML5-input-1) would work, but it occurred to me that since the File input widget is a wrapper around the HTML5 input function, it wouldn’t.

I’m not a particularly good web dev, so some of this is relatively foreign to me, but would a good approach be to use HTML’s `file` input type, and have a WebIO/Interact Javascript function that takes the data from the [File API](https://developer.mozilla.org/en-US/docs/Web/API/File/Using_files_from_web_applications) and passes it to Julia?

---

<div class="post-metadata">

**Author:** ![jpsamaroo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jpsamaroo/32/46804_2.png) [@jpsamaroo](https://discourse.julialang.org/u/jpsamaroo)\
**Post date:** [June 17, 2019, 8:12pm UTC](https://discourse.julialang.org/t/web-app-file-uploading/25370/4 "2019-06-17T20:12:24Z")

</div>

So this is the correct approach, but will require support from the webserver (Mux) to do something useful with the form data (specifically, the uploaded file content). I _think_ we have to wait on [https://github.com/JuliaWeb/HTTP.jl/pull/427](https://github.com/JuliaWeb/HTTP.jl/pull/427) to merge, and then add a middleware to Mux to do something with the uploaded data, which should arrive as a simple dictionary of form fields (one slot of which should contain the serialized file content).
