Adding image functionality to vcard in Jwchat+openfire

Hi,

I have added the plugin vcard avatar and followed the instructions in http://community.igniterealtime.org/docs/DOC-177

In javscript we cant browse and upload an image into database.I found that we should do this by encoding the image and storing in Photo tag in xml.I have also found the code to encode and decode by Base64.Can anybody suggest how to browse,upload,pass the uploaded file to encode and store the result in photo tag in xml?I have attached the vcard.html file where the changes are to be done.
vcard.html.zip (2013 Bytes)