Problem/Motivation
Part of #3221796: [META] Modernise file upload logic we identified that we are duplicating the code to find the file upload location in the following places:
\Drupal\file\Plugin\Field\FieldType\FileItem::getUploadLocation()
\Drupal\file\Plugin\rest\resource\FileUploadResource::getUploadLocation()
\Drupal\jsonapi\Controller\TemporaryJsonapiFileFieldUploader::getUploadLocation()
We can't really create a base class and use inheritance for this, as they use different methods of uploading files (ie. UploadedFile vs input stream).
Steps to reproduce
Proposed resolution
Create a trait that gets the upload destination from the field settings, and remove the duplication.