POST an image file using OData.Request

Jan 15, 2014 at 9:43 PM

Is there a way to POST an image using the OData.Request? I was able to POST some plain text, but I wasn't able to do it with an image. I keep getting "No handler for data". I want to know how I am supposed to pass the image file in the request. I have tried passing it as a base 64 string and a Blob object. It does not work.

Here's an example of the code I am trying

var headers = {  "Content-Type": "image/png",
            "Slug": "reddot.png" };

var oRequest = {
    headers: headers,
    requestUri: "..."
    method: "POST",
    data: file
OData.request( oRequest, fSuccessFn, fErrorFn );
Thanks for any help.