Upload attachments for custom content doesn't work for me :(

m trying to upload an attachment to a custom content but it’s not working and i get the error : at least one attachment must be included , even if when i console log the AP.reequest options, i see that the formData is passed nicely

Dear @YassirIMZI

I don’t know what is missing form your screenshot but can share how we have done it:

var file = $("#file-upload-element")[0].files[0];
var fileMod = new File([file], file.name, { type: file.type });

and later

AP.request({
			url: ...,
			type: 'POST',
			contentType: 'multipart/form-data',
			data: {comment : "", minorEdit: false, file: fileMod},

Andreas

1 Like

Thank you man , it worked, thank youuu,
the problem was that i downloaded the api collection for postman , and i saw in the postman example , that they ve used formData , and that was the problem , and in the end it’s that simple ,

Thank you man :smiley: