Skip to content

POST file via multipart/form-data not parsed correctly #3162

Description

When POST-ing a file (in this case a .docx or .pdf) to an Azure Function, the request is not correctly parsed, and the Body of the request within the function contains part of the Header of the request

Investigative information

Please provide the following:

  • Timestamp: N/A
  • Function App version (1.0 or 2.0-beta): 2.0-beta
  • Function App name: occurs locally
  • Function name(s) (as appropriate): N/A
  • Invocation ID: N/A
  • Region: N/A

Repro steps

Provide the steps required to reproduce the problem:

Expected behavior

The string should only contain the posted file payload

Actual behavior

The string contains some HTTP headers, along with the posted file payload, like so

----------------------------240199329954201831832994\r\nContent-Disposition: form-data; name=\"document\"; filename=\"test.docx\"\r\nContent-Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document\r\n\r\nPK\u0003\u0004\u0014\0\u0006\0\b\0\0\0!\0�\u0018���\u0001\0\0�\a\0\0\u0013\0\b\u0002[Content_Types].xml �\u0004\u0002(�\0\u0002\0\0\...

Known workarounds

Use ASP.NET core WebAPI instead.

Related information

I've written a blog post on this here https://www.andrew-best.com/posts/adventures-in-azure-functions/ with a few more details and screenshots.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions