While we're at it, consolidate duplicate code into a helper function and strictify a few arguments.
Attach a file by drag & drop or click to upload