APi image upload,and asset process

I’m having trouble trying to upload/create/process an asset using CMA (not SDK). I’ll explain my steps:

  1. I’m uploading an image.
  2. Im creating an asset with the id returned by the upload linked.
  3. I’m processing the asset.

I can see then the asset in Contentful web, but image says Loading like … forever, and never shows up.

I suspect it could be one of two things: either I am not providing the appropriate file for upload, or I’m not passing correctly the asset for processing it.

For the first I do the following:

` reader.onloadend = () => {

  var arrayBuffer = reader.result
  var bytes = new Int8Array(arrayBuffer);    

and for the second:

return axios .put( "https://api.contentful.com/spaces/" + space_id + "/assets/" + asset.data.sys.id + "/files/en-US/process", asset.data, config )
Any help would be appreciated. Thanks!

This was resolved on StackOverflow: https://stackoverflow.com/questions/50649523/contentful-management-api-upload-image

Ok, the problem was the way I was doing the image upload.
Previously (won’t work):
`const xhr: XMLHttpRequest = new XMLHttpRequest();
xhr.onreadystatechange = () => {
if (xhr.readyState === 4) {
if (xhr.status === 200 || xhr.status === 201) {
let data: any = JSON.parse(xhr.response);
} else {

const url = “https://upload.contentful.com/spaces/” + space_id + “/uploads”;
xhr.open(“POST”, url, true);
xhr.setRequestHeader(“Content-Type”, “application/octet-stream”);
xhr.setRequestHeader(“Authorization”, "Bearer " + token);
const formData = new FormData();
formData.append(“file”, file, file.name);

after(it works):
axios.post( 'https://upload.contentful.com/spaces/{space_id}/uploads, this.state.selectedFile, config )