There's still a bit of code repetition to be factored out.
Attach a file by drag & drop or click to upload