diff --git a/src/Extractor/TikaServerTextExtractor.php b/src/Extractor/TikaServerTextExtractor.php index be96e0d..28ca93a 100644 --- a/src/Extractor/TikaServerTextExtractor.php +++ b/src/Extractor/TikaServerTextExtractor.php @@ -127,6 +127,11 @@ class TikaServerTextExtractor extends FileTextExtractor public function getContent($file) { $tempFile = $file instanceof File ? $this->getPathFromFile($file) : $file; - return $this->getClient()->tika($tempFile); + $content = $this->getClient()->tika($tempFile); + //Cleanup temp file + if ($file instanceof File) { + unlink($tempFile); + } + return $content; } } diff --git a/src/Extractor/TikaTextExtractor.php b/src/Extractor/TikaTextExtractor.php index bda599b..5568351 100644 --- a/src/Extractor/TikaTextExtractor.php +++ b/src/Extractor/TikaTextExtractor.php @@ -80,6 +80,10 @@ class TikaTextExtractor extends FileTextExtractor $path = $file instanceof File ? $this->getPathFromFile($file) : $file; $command = sprintf('tika %s %s', $mode, escapeshellarg($path)); $code = $this->runShell($command, $output); + //Cleanup temp file + if ($file instanceof File) { + unlink($path); + } if ($code == 0) { return $output;