What would be the best way to update file uploads (updating the content of the file, not the target_id) using REST in Drupal 8?

We have a bunch of files in GIT that we will create entities for (custom entity type) and upload the files (using core or JSON API) etc using the existing POST method.

What I am not clear on is how we can update these files - we can't just create a new file_upload as that will change the file name and create a new file entity, however we need to overwrite those files not file rename exists.

So questions are: 1. Is there an existing way to do this? 2. Should we build a custom PATCH method to achieve this?

Any advice or pointers much appreciated.

  • This certainly is a hack, but how about adding something like drush core:rsync @gitsite:/my/files/ @prod:/my/files/ to your deployment script? – Hudri Apr 30 '19 at 11:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.