Uploading files from scripts is not allowed

I have a request like:

pm.sendRequest({
        url: pm.environment.get("mainUrl") + "/" + pm.environment.get("blackList") + "?name=" + name,
        method: 'POST',
        header: {
            'content-type': 'text/csv',
            'Authorization': "Bearer " + pm.environment.get("accessToken"),
            'Accept': "*/*"
        },
        body: {
            mode: 'formdata',
            formdata: [{
                "key": "file",
                "type": "file",
                "src": "resources/" + file
            }]
        }
    }

However, Iā€™m getting this error:

Uploading files from scripts is not allowed

I need to upload scripts from pre-request since we are making every test independent of each other. Is there any way to achieve this?

3 Likes

you solved the problem??? @vdespa Can you help us with this?

The error kinda says everything:

Uploading files from scripts is not allowed

Use a regular Postman request for this use-case.