From the client side the chain is as follows: upload method from the FileDetailV2 module then calls the upload method from the ConfigurationFileApi module. This ConfigurationFileApi module upload method triggers the server side UploadFile method from the FileApiService class that uses the FileRepository class that uses the FileUploader class UploadFile method (that calls the UploadInternal method (with additional validations) and finally uses the Upload method to upload the file). So the upload on the server side is performed using the Upload method from the FileUploader class.
To locate the place where the file should be uploaded the FileUploader upload method uses the EntityFileLocator method that uses the fileUploadConfig (that is an object formed from the client-side when the ConfigurationFileApi module upload method is called). For example if you are loading a file to the Contacts section the object to which the file will be saved is called ContactFile (and it can be also found in the database and configurations).