ensureTempDirectory(); try { $file->move(dirname($tempPath), basename($tempPath)); $result = $this->extractTask->run($tempPath); return $result; } finally { if (file_exists($tempPath)) { unlink($tempPath); } } } private function ensureTempDirectory(): void { $tempDir = storage_path('app/temp'); if (!is_dir($tempDir)) { mkdir($tempDir, 0755, true); } } }