original code, it still needs fiddling to make it work in general circumstances.
Attach a file by drag & drop or click to upload