Skip to content

How to make file upload easier? #1242

@marcw

Description

@marcw

The current state of file upload in api platform is unfortunately still a difficulty. I understand that it might not be in the scope of the project to handle uploads, but I think file upload is a really common feature in any web app and the project should make it easier for everyone to integrate upload in their api-platform app.

By the recent research, I found two schools for file upload:

  1. Small uploads can be formatted as a JSON structure and sent to the API. No big deal to implement. There are already plenty of resource available in the issues: See Handling file upload api-platform#12 or https://github.com/benjaminrau/media-api.

  2. Large uploads are more problematic. They cannot be put in a JSON structure. It forces the user to create a specific controller outside of the api-platform realm. It thus bypass the event system, and all the benefits of them (auto-persistence, auto serialization of created entity, auto serialization of errors, auto-endpoint documentation, etc).

What would be the best way to create a custom controller and still benefits from api-platform? Have you solve these issues? If so, would you mind sharing them so that we can update the documentation accordingly?

Thanks!

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