Use xmlhttprequest for upload

Addresses issue mozillahispano/openwapp#2 by reimplementing upload using XMLHTTPRequest instead of raw TCP sockets, also see issue loqui/im#538