false, 'error'=>'Cannot rename system files']); exit; } $oldReal = resolve_path($oldV); $newReal = dirname($oldReal) . '/' . basename($newName); if (!file_exists($oldReal)) { echo json_encode(['success'=>false,'error'=>'Not found']); exit; } $ok = rename($oldReal, $newReal); echo json_encode(['success'=>(bool)$ok]);