title: Api platform handling fille uploads
body: <p>I'm trying to upload files with Api Platform and Vich Uploader Bundle.
  When I send POST request with multipart/form-data and Id of the entity to attach image file to, I get 200 response with my entity. But uploaded file doesn't uploads to destination directory and it's generated filename doesn't persists. No errors, no any clues, no idea.</p>
  <p>Here is my code:</p>
  <pre><code>//vich uploader mappings
  vich_uploader:
      db_driver: orm
      mappings:
          logo:
              uri_prefix: /logo
              upload_destination: '%kernel.project_dir%/public/images/logo/'
              namer: App\Infrastructure\Naming\LogoNamer
  </code></pre>
  <pre><code>//Organization Entity
  &lt;?php
  
  namespace App\Infrastructure\Dto;
  
  ...use
  
  /**
   * @ORM\Entity()
   * @ApiResource(
   *     iri=&quot;https://schema.org/Organization&quot;,
   *     shortName=&quot;Place&quot;,
   *     collectionOperations={
   *          &quot;post&quot; = {
   *              &quot;denormalization_context&quot; = {
   *                  &quot;groups&quot;={
   *                      &quot;organization:collection:post&quot;
   *                  }
   *              }
   *          },
   *          &quot;get&quot; = {
   *              &quot;normalization_context&quot; = {
   *                  &quot;groups&quot;={
   *                      &quot;organization:collection:get&quot;
   *                  }
   *              }
   *          }
   *     },
   *     itemOperations={
   *          &quot;get&quot;,
   *          &quot;CreateOrganizationLogoAction::OPERATION_NAME&quot; = {
   *              &quot;groups&quot;={&quot;logo:post&quot;},
   *              &quot;method&quot;=&quot;POST&quot;,
   *              &quot;path&quot;=CreateOrganizationLogoAction::OPERATION_PATH,
   *              &quot;controller&quot;=CreateOrganizationLogoAction::class,
   *              &quot;deserialize&quot;=false,
   *              &quot;validation_groups&quot;={&quot;Default&quot;, &quot;logo_create&quot;},
   *              &quot;openapi_context&quot;={
   *                  &quot;summary&quot;=&quot;Uploads logo file to given Organization resource&quot;,
   *                  &quot;requestBody&quot;={
   *                      &quot;content&quot;={
   *                          &quot;multipart/form-data&quot;={
   *                              &quot;schema&quot;={
   *                                  &quot;type&quot;=&quot;object&quot;,
   *                                  &quot;properties&quot;={
   *                                      &quot;logoFile&quot;={
   *                                          &quot;type&quot;=&quot;string&quot;,
   *                                          &quot;format&quot;=&quot;binary&quot;
   *                                      }
   *                                  }
   *                              }
   *                          }
   *                      }
   *                  }
   *              }
   *          }
   *     }
   * )
   * @Vich\Uploadable
   */
  final class Organization
  {
      /**
       * @Groups({&quot;organization:collection:get&quot;})
       * @ORM\Id
       * @ORM\Column(type=&quot;uuid&quot;, unique=true)
       * @ORM\GeneratedValue(strategy=&quot;CUSTOM&quot;)
       * @ORM\CustomIdGenerator(class=UuidGenerator::class)
       * @ApiProperty(identifier=true)
       */
      protected Uuid $id;
  
      /**
       * @Groups({&quot;organization:collection:get&quot;, &quot;organization:collection:post&quot;})
       * @ORM\Column(type=&quot;string&quot;, length=100, unique=true)
       */
      public string $slug;
  
      /**
       * @ORM\Column(type=&quot;smallint&quot;)
       */
      public int $status;
  
      /**
       * @ApiProperty(iri=&quot;https://schema.org/name&quot;)
       * @Groups({&quot;organization:collection:get&quot;})
       * @ORM\Column(type=&quot;string&quot;, length=100, nullable=true)
       */
      public ?string $title = null;
  
      /**
       * @ApiProperty(iri=&quot;http://schema.org/logo&quot;)
       * @Groups({&quot;organization:collection:get&quot;, &quot;logo:post&quot;})
       * @ORM\Column(nullable=true)
       */
      public ?string $logoPath = null;
  
      /**
       * @ApiProperty(iri=&quot;https://schema.org/description&quot;)
       * @ORM\Column(type=&quot;text&quot;, nullable=true)
       */
      public ?string $description = null;
  
      /**
       * @ApiProperty(iri=&quot;https://schema.org/disambiguatingDescription&quot;)
       * @Groups({&quot;organization:collection:get&quot;})
       * @ORM\Column(type=&quot;string&quot;, length=150, nullable=true)
       */
      public ?string $disambiguating_description = null;
  
      /**
       * @ApiProperty(iri=&quot;https://schema.org/addressCountry&quot;)
       * @ORM\Column(type=&quot;string&quot;, length=2, nullable=true)
       */
      public ?string $country = null;
  
      /**
       * @ApiProperty(iri=&quot;https://schema.org/addressRegion&quot;)
       * @ORM\Column(type=&quot;string&quot;, nullable=true)
       */
      public ?string $region = null;
  
      /**
       * @ApiProperty(iri=&quot;https://schema.org/streetAddress&quot;)
       * @ORM\Column(type=&quot;string&quot;, nullable=true)
       */
      public ?string $street = null;
  
      /**
       * @ApiProperty(iri=&quot;https://schema.org/telephone&quot;)
       * @ORM\Column(type=&quot;string&quot;, nullable=true)
       */
      public ?string $telephone = null;
  
      /**
       * @ApiProperty(iri=&quot;https://schema.org/email&quot;)
       * @ORM\Column(type=&quot;string&quot;, nullable=true)
       */
      public ?string $email = null;
  
      /**
       * @ApiProperty(iri=&quot;https://schema.org/contentUrl&quot;)
       * @Groups({&quot;logo_read&quot;})
       */
      public ?string $logoContentUrl = null;
  
      /**
       * @var File|null
       *
       * @Assert\NotNull(groups={&quot;logo_create&quot;})
       * @Vich\UploadableField(mapping=&quot;logo&quot;, fileNameProperty=&quot;logoPath&quot;)
  
       */
      public ?File $logoFile = null;
  
      public function __construct()
      {
          $this-&gt;status = OrganizationStatus::DRAFT()-&gt;getValue();
      }
  
      public function getId(): ?Uuid
      {
          return $this-&gt;id ?? null;
      }
  
      public function setId(Uuid $id)
      {
          $this-&gt;id = $id;
      }
  }
  </code></pre>
  <pre><code>final class CreateOrganizationLogoAction extends AbstractController
  {
      const OPERATION_NAME = 'post_logo';
  
      const OPERATION_PATH = '/places/{id}/logo';
  
      private OrganizationPgRepository $repository;
  
      public function __construct(OrganizationPgRepository $repository)
      {
          $this-&gt;repository = $repository;
      }
  
      /**
       * @param Request $request
       *
       * @return EntityOrganization
       */
      public function __invoke(Request $request): EntityOrganization
      {
          $uploadedFile = $request-&gt;files-&gt;get('logoFile');
          if (!$uploadedFile) {
              throw new BadRequestHttpException('&quot;file&quot; is required');
          }
  
          $organization = $this-&gt;repository-&gt;find(Uuid::fromString($request-&gt;attributes-&gt;get('id')));
          $organization-&gt;logoFile = $uploadedFile;
  
          return $organization;
      }
  }
  </code></pre>
  <p>I'm sending request:</p>
  <pre><code>curl -X POST &quot;http://localhost:8081/api/places/0dc43a86-6402-4a45-8392-19d5e398a7ab/logo&quot; -H &quot;accept: application/ld+json&quot; -H &quot;Content-Type: multipart/form-data&quot; -F &quot;logoFile=@test.png;type=image/png&quot;
  </code></pre>
  <p>... and getting response:</p>
  <pre><code>{
    &quot;@context&quot;: &quot;/api/contexts/Place&quot;,
    &quot;@id&quot;: &quot;/api/places/0dc43a86-6402-4a45-8392-19d5e398a7ab&quot;,
    &quot;@type&quot;: &quot;https://schema.org/Organization&quot;,
    &quot;slug&quot;: &quot;consequatur-aut-optio-corrupti-quod-sit-libero-aspernatur&quot;,
    &quot;status&quot;: 0,
    &quot;title&quot;: &quot;Block LLC&quot;,
    &quot;logoPath&quot;: &quot;a268cde1-d93e-4d48-9f0d-177b4f89f1f8.png&quot;,
    &quot;description&quot;: &quot;Nisi sint ducimus consequatur dicta sint maxime. Et soluta facere in quisquam quia. Tempore quae non qui dignissimos optio rem cum illum. Eum similique vitae autem aut. Reiciendis nesciunt rerum libero in consequuntur excepturi repellendus unde. Tempore ea perferendis sunt quibusdam autem est. Similique qui illum necessitatibus velit dolores. Voluptas sapiente excepturi ad assumenda exercitationem est. Nesciunt sint sint fugiat quis blanditiis. Rerum vel sint temporibus nobis fugiat nostrum aut. Voluptatibus temporibus magnam cumque asperiores. Adipisci qui perferendis mollitia tempore accusantium aut. Possimus numquam asperiores repellendus non facilis.&quot;,
    &quot;disambiguating_description&quot;: &quot;Et libero temporibus ut impedit esse ipsum quam.&quot;,
    &quot;country&quot;: &quot;RU&quot;,
    &quot;region&quot;: &quot;Idaho&quot;,
    &quot;street&quot;: &quot;15544 Delbert Underpass&quot;,
    &quot;telephone&quot;: &quot;+78891211558&quot;,
    &quot;email&quot;: &quot;lhintz@corwin.com&quot;,
    &quot;pictures&quot;: [],
    &quot;social_profiles&quot;: [],
    &quot;logoContentUrl&quot;: &quot;/logo/a268cde1-d93e-4d48-9f0d-177b4f89f1f8.png&quot;,
    &quot;logoFile&quot;: &quot;data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEASABIAAD//gA7Q1JFQVRPUjog
  ...
  ...
  ... TgjNWnJ7YWPrMCWGxWbi57Tj58TfPQL1Hi54DRFD/FkuLcuXBKFB3TFLcuaUvpqKuYUJaLL/yV/R/+kf/Z&quot;,
    &quot;id&quot;: &quot;0dc43a86-6402-4a45-8392-19d5e398a7ab&quot;
  }
  </code></pre>
  <p>As you can see it's all ok. Proper organization was found. And even logoFile field was filled with uploaded picture. But uploaded file wasn't moved to destination. And logoPath contains old logo filename.</p>
  <p>As I said no errors.
  Please help me to figure out where to dig.</p>