getRealPath() ?: $file->getPathname(); if (! $sourcePath) { return false; } $stream = fopen($sourcePath, 'rb'); if (! $stream) { return false; } try { return Storage::disk($disk)->put($path, $stream); } finally { if (is_resource($stream)) { fclose($stream); } } } }