Set Vdefault_minibuffer_frame to t before deleting a frame that might have its own minibuffer.
Attach a file by drag & drop or click to upload