Here below is a very simple chat demo written using jQuery and StropheJS with file transfer features. Implementation of file transfer is based on these two Strophe.js plugins:
https://github.com/strophe/strophejs-plugins/tree/master/si-filetransfer: it allows to send and receive stream initiations
https://github.com/strophe/strophejs-plugins/tree/master/ibb. it provides a transport mechanism (In-Band Bytestream)
In addition, in order to allow the transfer of files greater than 65535 bytes it is also used a chunking algorithm.
Here is the Plunker: http://plnkr.co/edit/fYpXo1mFRWPxrLlgr123
P.S.: you have to deploy your own XMPP server and adapt the following code lines according to your configuration:
var server = 'mydomain.com';
var BOSH_SERVICE = 'http://127.0.0.1:7070/http-bind/';