Drupal\file\Plugin\rest\resource\FileUploadResource->post() has a lot of useful file handling code which can be reused. Currently it's tied to the Field API with lines such as $destination = $this->getUploadLocation($field_definition->getSettings());. This prevents its use when not using the field API (e.g. Webform).
While $field_definition->getSettings() is the most obvious, there could be others. Removing this from the post() method means it would be possible to extend the class and only need to override some helper methods, such as getUploadLocation() and validateAndLoadFieldDefinition().
Let me know if I need to provide further information or a specific use case.
Comments
Comment #2
imclean commentedAlternatively, the file handling code could be moved outside
post().Comment #3
imclean commentedComment #4
imclean commented