protected function fetchUploadedFile($form)
    {
        $file = '';

        // for backward compatibility
        if ($form instanceof \tao_helpers_form_Form) {
            $fileInfo = $form->getValue('source');

            /** @var string $file */
            $file = $form->getValue('importFile') ?: $fileInfo['uploaded_file']; // key "importFile" used in CSV import
        } else if (isset($form['uploaded_file'])) {
            /** @var File $file */
            $file = $this->getUploadService()->getUploadDir()->getFile($form['uploaded_file']);
        }

        if (!$file) {
            throw new \common_exception_Error('No source file for import');
        }

        return $file;
    }