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
0 comments

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

Please sign in to leave a comment.

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

Top
Didn’t find what you were looking for? Write new post