I have seen what the author this topic answer what had resolved problem add to code base64 codification before send data. I already make a "reproduction" based in he speak like this:
base64 is NOT binary data, so it should be safe to use sprintf in this case. However this is not the proper way to upload a file to a webserver (the size will increase and you should already have data encoded in base64)