I am recieving a 500 "File name cannot be null or empty" error on the CreateAttachment API

I am trying to upload some attachments to a confluence wiki page through the create attachment API.

I am using this javascript rest api as a test but keep getting an error after following all examples I can find on it:

      url: `/rest/api/content/${content_id}/child/attachment`,
      type: "POST",
      contentType: "multipart/form-data",
      data: { file: file, minorEdit: true },



The exact error I get back is: {“statusCode”:500,“message”:“java.lang.IllegalArgumentException: File name cannot be null or empty.”}

Any other fields I might be missing in the request? I don’t see anything else in the documentation on this.

I appreciate your quick response.

Thank You.