Can't upload file using JS SDK

We tried everything to use these two methods

  1. sendFileMessage
  2. updateCurrentUserInfoWithProfileImage

with converting picture to file using this method: https://stackoverflow.com/a/62432112/4591364

But we get this error:
“Invalid Parameters”

So please we need a little support to answer my little question about why the request gets this error “Invalid Parameters”…

Code looks like this:

fetch(base64String)
  .then((res) => res.blob())
  .then((blob) => {
    const file = new File([blob], fileName, {
      type: "image/png",
    });
    this.sendBird.updateCurrentUserInfoWithProfileImage(user.nickname, file);
  });

Hi @smsm,

Welcome to the Sendbird Community.

I put together a quick example of how you might upload images via Javascript: FileUploadExample (forked) - CodeSandbox

Hi @Tyler

We try to upload an image that is not coming from a form…

Still can’t do it till now

Hello @smsm, Could you tell me where the image is coming from so I can try and reproduce the behavior for you?

@smsm,

I updated the example to use a base64 string: FileUploadExample (Base64) - CodeSandbox