File transfer is simple using the XMPP protocol. That said, there need not be an in-band transfer of the file. A better recommendation would be that you employ a media server to upload a file and then use a simple text message to share the link.

There are only a couple of thing that I would want to add here:

  1. Use JSON to pass messages between users, even for simple text messages. That way, you can add a whole lot of metadata to each message.
  2. Use file hashing to figure out if a file has already been uploaded to the media server: this way, you will avoid wastage of valuable server space and bandwidth.

Original post:

Image courtesy: By Original Author: Raja SANDHU for XMPP Standards Foundation. Edited by Ludovic BOCQUET: A first time in September 2017 and a second time in September 2019. - https://xmpp.org/, MIT, https://commons.wikimedia.org/w/index.php?curid=20775269
Please spread the word among your friends & associates