Skip to content
This repository has been archived by the owner on Jun 3, 2023. It is now read-only.

SwaggerFormDataFile

Jussi Saarivirta edited this page Feb 16, 2019 · 2 revisions

SwaggerFormDataFileAttribute

Indicates that the request body of this method is a file (multipart/form-data).

Example usage:

[SwaggerFormDataFile(true, "file", "Description")]
[SwaggerFormData("text", false, typeof(string), "Description")]
[SwaggerFormData("number", false, typeof(int), "Description")]
[Consumes("multipart/form-data")]
[FunctionName("MultipartFormUploadAnnotation")]
public static async Task<IActionResult> MultipartFormUploadAnnotation([HttpTrigger(
    AuthorizationLevel.Anonymous, "post", Route = null)] HttpRequest req,
    ILogger log)
{
    log.LogInformation("Triggered");

    var formData = await MultipartFormReader.Read(req);
    return new OkObjectResult(formData);

}