naïve approach
- rely on files property being set
- fails because while clicking on the input and selecting files will set the property correctly, dragging and dropping does not actually interact with the input and set the property. The property cannot be set manually (react-dropzone/react-dropzone#131) using javascript for security reasons.
- thus when the form is submitted the file input has no files property and nothing is uploaded.
let's use javascript, then!
- submit the form using fetch, create a FormData from the form and manually set the files field using state set using the onDrop callback from Dropzone
- only set the files field if it's not set (because the user could have clicked and chosen files instead of dragging and dropping)
- FormData has a great API for inspecting its keys and values! I'll use FormData#getAll() and see if the files are populated
- works great in chrome and ff!