Dealing with a special webservice I must upload a csv file.
The JavaScript code to do this using jQuery is:
var data = new FormData();
data.append('file', document.getElementById('file').files[0]);
$.ajax({
url: 'https://xx',
method: 'POST',
data: data,
contentType: false,
processData: false
});
I would like to do that with powershell:
$A = Invoke-RestMethod -Method Post -Uri $uri -InFile $filename
Doing this I get a Server error 500 back that this is not a multipart request
If I look into the jQuery documentation I find that contentType: false mean sending no contenttype at all.
How can I archive that with the invoke-restmethod?
I have tried it with -contentType "", but this doesn't work.
Any idea?