Maybe littlebit hackis implementation and core could be better place to implement this.
Attach a file by drag & drop or click to upload