I want to create a new endpoint in an existing asp.net core API. It should be possible to upload multiple files with a linked text string to each file. I also want to use PostMan to test this endpoint. Is it possible to do this?
This is my C# test code that runs but i don't know how to call it from PostMan:
[HttpPost("upload/test")]
public async Task<IActionResult> FileUpload([FromForm]UploadModel fileUpload)
{
return FileUpload(fileUpload);
}
public class UploadModel
{
/// <summary>
/// Files to upload
/// </summary>
public List<FileModel> Files { get; set; }
public string UploadInfo{ get; set; }
}
public class FileModel
{
public IFormFile File { get; set; }
public string FileText { get; set; }
}
For passing List Object from postman to api, you could try struct like parameterName[index].fieldName
.