When using API run_cutom_method cmd=upload_file ERR_ABORTED 403 (FORBIDDEN)

I’m always get the error ERR_ABORTED 403 (FORBIDDEN) every time i try to using REST API to upload files !

This is my code

						var xhr = new XMLHttpRequest();
						xhr.open('POST', '', true);
						xhr.setRequestHeader('ACCEPT', 'application/json');
						xhr.setRequestHeader("Authorization", "Basic " +  btoa("xxxxx:yyyyy"));
						var b = getBinary(data.pdf_web_location);
						var b64 = base64Encode(b);
						let from_data = new FormData();
						from_data.append('cmd', 'uploadfile')
						from_data.append('filename', 'test.pdf');
						from_data.append('filedata', b64);
						from_data.append('doctype', 'Document');
						from_data.append('docname', 'DOC-2019-10-00001');
						from_data.append('is_private', '1');
						from_data.append('from_form', '1');

Any Help!

I’m stuck in this issue , is there is anybody cares!:roll_eyes:

You must use uid + pwd authentication, or use


This might help: