private function extractFileFromString($fileContent, $originalFileName = null)
    {
        $tmpName = $fileName = uniqid(true);

        if (!is_null($originalFileName)) {
            $fileName = $originalFileName;
        }

        $dir = ini_get('upload_tmp_dir');
        $dir = (empty($dir)) ? sys_get_temp_dir() : $dir;
        $tmpFile = $dir . DIRECTORY_SEPARATOR . $tmpName;

        // create temporary file;
        (new Filesystem())->dumpFile($tmpFile, $fileContent);
        $file = new File($tmpFile);

        return new UploadedFile(
            $file->getRealPath(),
            $fileName,
            $file->getMimeType(),
            $file->getSize()
        );
    }