Is there a way to upload a document temporarily until comments are added?"

Certified Associate Developer

I have requirement in which a user uploads a document while composing a comment. The uploaded document should be stored temporarily, and its ID held until the user submits the comment. If the comment is submitted, the document becomes permanent; otherwise, it should remain temporary.

  Discussion posts and replies are publicly visible