Skip to content

MapRequestPayload with UploadedFile #52678

@jurchiks

Description

@jurchiks

Description

It would be very nice if MapRequestPayload also supported UploadedFile fields. Currently I haven't found absolutely any documentation stating that it does.

Example

readonly class UploadImageDTO
{
  public function __construct(
    public string $title,
    public string $description,
    // Add assertions about mime type and size, if possible.
    public UploadedFile $file,
  ) {}
}

class SomeController
{
  public function uploadImage(
    #[MapRequestPayload] UploadImageDTO $requestData
  ): Response
  {
    // $requestData->file is guaranteed to be an UploadedFile
  }
}

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

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy