How can I add attachment in SharePoint I am stuck on this problem hopefully can help me to proceed this problem. I will so much appreciate your help. Thank you.
You have used SP.RequestExecutor which is used for making cross domain calls and if so your _spPageContextInfo.webServerRelativeUrl won't work. Either you need to use query string to get the url or try using hard code url value. For getting url from query string
var scriptbase = hostweburl + "/_layouts/15/";
For reference Click here
With regards to the error your encountering , I believe you want to change your call to
The following article provides a good breakdown on the properties available on