Web App File Uploading

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?

1 Like

A plain HTML form seems like the most straightforward solution.

1 Like

Initially, I thought a custom HTML5 file input widget 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 and passes it to Julia?

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 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).