Send image as attachment

Hi!

I would like to know, how can I send image as attachment in React Native application?

I'm using FileReader() and .readAsDataURL() method to read image.

var obj = {  
   method: 'POST',
  body: img,
   headers: {
     'Authorization': 'bearer '+accessToken,
     'X-File-Name': "example-shrunk.png",
     'Content-Type': 'application/octet-stream',
     'X-Requested-With': 'XMLHttpRequest',
   },
  };

  fetch("https://www.wrike.com/api/v4/tasks/"+testID+"/attachments", obj).then(function(res) {
   console.log(res);
   });
 
I'm sending image to Wrike, but I'm having an error "The file is damaged or contains errors".
0
👍 Spot On 💡 Innovative Approach 💪 Stellar Advice ✅ Solved 🪄 Remove Kudos
0 комментариев

Can you help? Answer the question and work your way towards becoming a Wrike Ninja 🥋 Sign in and answer.

Войдите в службу, чтобы оставить комментарий.

Folllowing List for Post: Send image as attachment
[this list is visible for admins and agents only]

Вверх
Didn’t find what you were looking for? Write new post