Upload a Media file to contenful

I made an Web App extension to manage several images to focus a crop, and then save these images to contenful media repo. But it’s impossible !

I have the blob image for each image correctly because I export to my disk with any problem. But if I try to use the sdk.createAsset passing this object:

In this example the this.state.croppedImage_1024x768 it’s the blob with my image

              var fileData = {
                  fields: {
                    title: {
                      'en-US': this.props.imageTitle + ' 1024x768',
                    file: {
                      'en-US': {
                        fileName: this.props.imageTitle + ' 1024x768',
                        contentType: this.state.croppedImage_1024x768.type,                                                

                  .then((asset) =>  {

                  .catch((err) => {

I obtain this error

  "status": 422,
  "statusText": "",
  "message": "Validation error",
  "details": {
    "errors": [
        "name": "type",
        "value": {},
        "type": "Symbol",
        "details": "The type of \"value\" is incorrect, expected type: Symbol",
        "path": [
  "request": {
    "url": "https://api.contentful.com:443/spaces/63zmlf3o2iun/environments/master/assets",
    "headers": {
      "Accept": "application/json, text/plain, */*",
      "Content-Type": "application/vnd.contentful.management.v1+json",
      "X-Contentful-User-Agent": "app contentful.web-app; platform browser; sha 2babaa05cd1f8dacc554b40ec360504d5affbf1b",
      "Authorization": "Bearer ...KiPnE"
    "method": "POST"
  "requestId": "474aeb33ee76c97057f79e8d29bb938e"

How can I upload a image file generetate inside my contenfull web app extension to media contenful repository?

1 Like