Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[HttpFoundation] Request::getContentType doesn't support multipart/form-data #34240

Copy link
Copy link
Closed
@keichinger

Description

@keichinger
Issue body actions

I've asked @nicolas-grekas on Twitter and it felt like he wasn't sure, so I investigated a little bit more and found the following sentence in the specs:

According to https://www.w3.org/TR/html401/interact/forms.html#h-17.13.4.2:

The content type "multipart/form-data" should be used for submitting forms that contain files, non-ASCII data, and binary data.

In my opinion, Request::getContentType(), or much rather Request::initializeFormats() should map multipart/form-data to form, as it's per-spec related to submitting forms with mixed data. Right now the behaviour is to return null, which is confusing and cumbersome when you have a controller action that is called via a regular POST and via fetch + new FormData() as body from your frontend.

I'd be very happy to file a PR to add it to the mapping.

Opinions?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.