I'm in a quandary on how to get this working. In Postman, I can upload an attachment without any issue. I'm uploading a simple text file. The code from postmanshows this:
var form = new FormData();
form.append("uploadFile", "C:\\temp\\test.txt");
var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://xxxxxxx.service-now.com/api/now/attachment/file?table_name=problem&table_sys_id=oiui5346jh356kj3h634j6hk&file_name=Toast",
  "method": "POST",
  "headers": {
    "Accept": "application/json",
    "Content-Type": "application/x-www-form-urlencoded",
    "Authorization": "Basic xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx==",
    "Cache-Control": "no-cache",
    "Postman-Token": "39043b7f-8b2c-1dbc-6a52-10abd25e91c1"
  },
  "processData": false,
  "contentType": false,
  "mimeType": "multipart/form-data",
  "data": form
}
$.ajax(settings).done(function (response) {
  console.log(response);
});
When I use this on an .asp page I get a 400 error and a response from the console that says: "Failed to create the attachment. File part might be missing in the request." How do you get the file you want attach into the code correctly. I thought hard coding it in would have worked. How do you get the code to find the file on the local users pc. Once I get this working I eventually want to have a file input button to select the file.
Thanks, Scott
 
    