Set minibuffer-completing-file-name and call substitute-in-file-name.
Attach a file by drag & drop or click to upload