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,
});
Uploading attachment using JavaScript
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.
Login to the community
No account yet? Create an account
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.