Uploading attachment using JavaScript

Avec réponse


Publication le 17 mars 2021

I am trying to upload an attachment (dummy.png), the response is that the attachment has been created as I get a 201 response with a token.
 
I then attach the token to the uploads array before submitting a new ticket. The issue I am having is when I view the ticket, the attachment is corrupted. I am wondering whether it is how i am uploading the attachment in the first place.
 
This is my header below for uploading an attachment. Can someone let me know if there is an issue here?
 
Thank you.
 
const response = await axios.post(`uploads.json?filename=dummy.png`, body, {

baseURL: '/api/v2',

headers: {

common: {

Accept: 'application/json',

'Content-Type': 'image/png',

mode: 'no-cors',

Authorization: `Basic ${process.env.token}`,

},

},

withCredentials: true,

});

0

5

0 commentaire

      Se connecter pour laisser un commentaire.

      Vous ne trouvez pas ce que vous cherchez ?

      Nouvelle publication