REST API Media File Post

I'm trying to upload files to media gallery.. using just the rest calls. I keep getting an error: Only a posted file, file URL, or file upload context is valid, but not more than one.

This rest call is in a method called model.createMediaPost(args) but this is just the important part which is the rest call

$.telligent.evolution.post({
                url: _baseUrl + _mediaRestApi,
                callback: callback ? callback : _callbackname,
                data: { 
                   "mediagalleryid": _mediagalleryId,
                   "Name": _name,
                   "FileName":_filename, 
                   "FileData": _filedata,
                   "Tags": _tags,
                   "ContentType":_contenttype
                },
                cache:false})
                .error(function (err) {
                    console.info("error with media  file rest call:", err);
                    _error = err;
                }).success(function (r) {


                    if (typeof callback !== 'undefined' && typeof callback === 'function') {
                        callback(r);
                    }

                    _results = r;
                });

The byte[] maybe okay... but here is the code that calls the above method "createMediaPost":


var filedata = [];
var reader = new FileReader();

	reader.onloadend = function (evt){
		if (evt.target.readyState == FileReader.DONE) {
			var arrayBuffer = evt.target.result,
				array = new Uint8Array(arrayBuffer);
			for (var i = 0; i < array.length; i++) {
				filedata.push(array[i]);
			 }
		   
		  model.createMediaPost(mediagalleryId, name, description, filename, filedata, tags, function(result){
			console.info("media gallery posted");
			console.info(result);

		  });
		}

	};
	reader.readAsArrayBuffer(file);