patching binary file uploads

The binary file upload was not working for me for two reasons.  First, the data was not getting properly base64 encoded.  Second, the target for binary data is attachment rather than value.

My git skills are weak, I tried to do this in a clean branch but managed to include commits from master by accident and now I can't seem to get rid of them.  This PR should apply on top of #10 without difficulty though.