Uploading file using jquery and ajax

I am having a hard time trying to figure out how to do this. There is a file input where the user can select an excel file.

`<input type="file" id="myfile" name="myfile">`

I am not sure how this is going to work, according to the api request body the api is going to take an object containing an array of excel files

    type: "array",
    items: {
       type: "string",
       example :"holidaylist.xlsx",
       format: "binary"

Then the api looks like this

updateHolidayList: funtion(postData){
return new Promise((resolve, reject) => {
url: url link,
data: postData,

I am not sure what to do with this binary dataType, but right now I am working with a modal that shown after a button is clicked, and inside that modal is there the input is and the user can select the file. Once the user presses save in the modal it will call the api and either show the success or fail message

$('#holidayUpload).on("click", function () {
   let postData = {
        filename: "something here?"

Not sure if this is on the right track, but I also read somewhere that I need to use form data. What would be a easier way to do this?

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.