Skip to content

Handling File Upload Error #2713

@sta2m

Description

@sta2m

API Platform version(s) affected: 3.3.3

Description

I have an issue when doing a POST request to upload a file, using the example from the docs

Error : Could not resolve argument $data of "api_platform.action.placeholder::__invoke()", maybe you forgot to register the controller as a service or missed tagging it with the "controller.service_arguments"?"

Same as : #2539 (comment)

How to reproduce

See docs

Possible Solution

This workaround work for me : #2539 (comment)

Additional Context

My conf :

    title: Hello API Platform
    version: 1.0.0
    # Mercure integration, remove if unwanted
    mercure:
        enabled: false
        include_type: true
    formats:
        jsonld: ['application/ld+json']
        multipart: [ 'multipart/form-data' ]
    docs_formats:
        jsonld: ['application/ld+json']
        jsonopenapi: ['application/vnd.openapi+json']
        html: ['text/html']
    # Good defaults for REST APIs
    defaults:
        stateless: true
        cache_headers:
            vary: ['Content-Type', 'Authorization', 'Origin']
        extra_properties:
            standard_put: true
            rfc_7807_compliant_errors: true
    # change this to true if you use controllers
    use_symfony_listeners: true
    keep_legacy_inflector: false
    swagger:
        api_keys:
            JWT:
                name: Authorization
                type: header

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions