docs icon indicating copy to clipboard operation
docs copied to clipboard

file-upload-and-linking-admin-panel

Open yudhir opened this issue 6 years ago • 5 comments

Use decorating your dataprovider feature of React Admin to upload a Multi-part File upload.

yudhir avatar Nov 30 '19 21:11 yudhir

I think we don't need this anymore with https://api-platform.com/docs/admin/file-upload/.

alanpoulain avatar Jan 20 '21 08:01 alanpoulain

Yeah , if it does the same thing , we don't need it . Edit : It is not to upload a media_object itself but a media object for a entity (book for example)

yudhir avatar Jan 20 '21 09:01 yudhir

You can use it to create an entity and upload its related file at the same time too (it needs to be handled a little differently in the back but it is feasible: I've done it recently). It will avoid to make 2 requests (and handle correctly the errors).

alanpoulain avatar Jan 20 '21 09:01 alanpoulain

You can use it to create an entity and upload its related file at the same time too (it needs to be handled a little differently in the back but it is feasible: I've done it recently). It will avoid to make 2 requests (and handle correctly the errors).

That could be added in the admin-docs as an example . It meets many practical usecases.

yudhir avatar Jan 20 '21 10:01 yudhir

Yes it would be a nice addition indeed. I don't know if I will have the time to do it, but you need two things:

  • a custom MultipartDecoder
  • a custom denormalizer

With this, a POST endpoint can be used with multipart/form-data (file + data).

alanpoulain avatar Jan 20 '21 10:01 alanpoulain