Moved the code which detaches from the parent process/session to a separate function.
Attach a file by drag & drop or click to upload