How to upload a file in Monday using api. I am using react to do so

I am using a react app to upload a file in it and then want to save it to Monday using api. I have tried it by using Monday SDK.

-------------------Code starts-------------------------
let query = mutation { add_file_to_column (item_id: 1867830321, column_id: "files", file: C:/Users/HP/Downloads/googleDocsLogo.png) { id } };

monday.api(query)
.then(res => { console.log('res is '+JSON.stringify(res)) })
.catch(error => { console.log('error is '+error) })

-------------code ends-----------------

I have tried using fetch request as well but there getting ‘cors’ issue.

@YuvrajSinghRajput I doubt very much that you can just specify a location on your HDD and hope for the best. You’ll need to add the content of the file to the request and post it to https://api.monday.com/v2/file.

If CORS is a problem that suggests you’re doing this client side, you’ll probably want some server side code to perform this operation.

Take a look at this example for clues:

@YuvrajSinghRajput Or have a look at this: