I am trying to automate uploading over 100 files using a PUT method. However I’ve been unsuccessful after many attempts. I keep getting the following error: ‘uploading files from scripts is not allowed’. I know that I can upload a file manually then choosing form-data, binary etc but that is NOT what I want to do. I want to upload the files by just clicking the Send button (no additional steps)
My workflow:
- /POST method to create a thing
- /PUT method to add a file to that thing*:
Details:
I’ve already tried:
let test = JSON.parse(pm.environment.get('test'));
pm.sendRequest({
url: test.url,
method: 'PUT',
headers: {
'Content-Type': 'application/pdf'
},
body: {
mode: 'file',
file: JSON.stringify({
src: '/path/to/my/file'
})}
}, function(err, res) {
console.log(res);
});