I have an apex method that takes in a Blob input argument and needs to be called from javascript. When I pass in a Javascript Blob, I get what seems to a be type mismatch error from VFRemote.js:
"Visualforce Remoting Exception: Unexpected type for TestClass.testRemoteAction(Blob)" {statusCode: 400, type: "exception", tid: 2, ref: false, action: "TestClass", method: "testRemoteAction", message: "Unexpected type for TestClass.testRemoteAction(Blob)", where: "", data: Array[1], vfTx: true, 2 more…} VFRemote.js:116 null
Here's my javascript snippet:
var binaryMsg = new Uint8Array(message);
var blobMsg = new Blob(binaryMsg, {type: "octet-stream"});
Visualforce.remoting.Manager.invokeAction(
'{!$RemoteAction.TestClass.testRemoteAction}',
blobMsg,
function(result, event) {console.log(result);}
);
EncodingUtil.base64Decode(String)