This most likely occurs because the right ContentType
of the VFS transport is not used.
When transferring binary data, use this:
<parameter name="transport.vfs.ContentType">application/octet-stream</parameter>
I just tried it on WSO2 ESB 4.0.3 and it worked fine for a png file, while using text/plain
for the value of the transport.vfs.ContentType
parameter was throwing the same exception as you described.
Check out the Synapse VFS service parameters here.