Use `tramp-rsh-end-of-line', it ought to be more robust.
Attach a file by drag & drop or click to upload