Multipart/form-data request in k6 is throwing the following error "file is not defined"

Getting the following error “file is not defined” when I send the following multipart/form-data request in k6. what is wrong with following request?

Response: ERRO[0008] ReferenceError: file is not defined


import http from 'k6/http';
import encoding  from 'k6/encoding';
import { check, group, sleep } from 'k6';
import { md5 } from 'k6/crypto';

const txtFile = open('./TextFile.txt');

export default function () {
    let params = {
        headers: {'Content-Type': 'application/json', },
        tags: {name: 'AuthToken',},

    params.headers['transaction-id'] = guid(); = 'postSend';
    let txtMsg = "<p>Performance Test-";
    let data = {
       'attachments[0].description': '',
       'attachments[0].file': http.file(txtFile,'TextFile.txt'),
       'attachments[0].kind': file,
       'content': txtMsg.concat(, "</p>"),
       'forumId': pForumId,
       'isDraft': 'false'     };

    res ='api/v1/orchestrate/forum/post/send'), data, params);

Hi @sbellam1187
On the line

       'attachments[0].kind': file,

I guess you meant file to be quoted as in "file" as no file has been defined before that :wink: