Classes/Slots/FileUpload.php
public function postFileReplace(File $file, $uploadedFileName)
    {
        $folder = $file->getParentFolder();
        $storageConfiguration = $folder->getStorage()->getConfiguration();
        $storageRecord = $folder->getStorage()->getStorageRecord();
        if ($storageRecord['driver'] !== 'Local') {
            // Unfortunately unsupported yet
            return;
        }

        $targetDirectory = $storageConfiguration['pathType'] === 'relative' ? PATH_site : '';
        $targetDirectory .= rtrim(rtrim($storageConfiguration['basePath'], '/') . $folder->getIdentifier(), '/');
        $targetFileName = $targetDirectory . '/' . $file->getName();

        $this->processFile($targetFileName, PathUtility::basename($targetFileName), $targetDirectory, $file);
        $this->populateMetadata($file, $folder);
    }
public function postFileReplace(File $file, $uploadedFileName)
    {
        $folder = $file->getParentFolder();
        $storageConfiguration = $folder->getStorage()->getConfiguration();
        $storageRecord = $folder->getStorage()->getStorageRecord();
        if ($storageRecord['driver'] !== 'Local') {
            // Unfortunately unsupported yet
            return;
        }

        $targetDirectory = $storageConfiguration['pathType'] === 'relative' ? PATH_site : '';
        $targetDirectory .= rtrim(rtrim($storageConfiguration['basePath'], '/') . $folder->getIdentifier(), '/');
        $targetFileName = $targetDirectory . '/' . $file->getName();

        $this->processFile($targetFileName, PathUtility::basename($targetFileName), $targetDirectory, $file);
        $this->populateMetadata($file, $folder);
    }
A file is about to be added as a *replacement* of an existing
one.

@param File $file
@param string $uploadedFileName
@return void