tencent cloud

Smart Media Hosting

Renaming a file

Download
포커스 모드
폰트 크기
마지막 업데이트 시간: 2026-01-07 10:49:08

Introduction

This document provides an API overview about moving or renaming files as well as SDK sample code.
API
Operation Description
Move or Rename File

SDK API Reference

For specific parameters and method descriptions of all SDK APIs, please see SDK API Reference.

Moving or Renaming a File

Feature Description

Used for moving or renaming files.

Sample Code

QCloudSMHRenameFileRequest *req = [QCloudSMHRenameFileRequest new];
// Space ID; if the media library is in single-tenant mode, this parameter is fixed as a hyphen (-); if the media library is in multi-tenant mode, you must specify this parameter
req.spaceId = @"spaceId";
// Media Library ID, required parameter
req.libraryId = @"libraryId";
// Target file name
req.from = @"targetname";
// Complete file path
req.filePath = @"filePath";
/// Handling method when filename conflict occurs, default is rename
/// ask: Returns HTTP 409 Conflict and error code SameNameDirectoryOrFileExists when conflicts with
/// rename: Automatically rename the file when conflicts with
/// overwrite: Returns HTTP 409 Conflict and error code SameNameDirectoryOrFileExists when the target is a directory, otherwise overwrites the existing file;
req.conflictStrategy = QCloudSMHConflictStrategyEnumOverWrite;
[req setFinishBlock:^(QCloudSMHRenameResult *result, NSError *_Nullable error) {
}];
[[QCloudSMHService defaultSMHService] renameFile:req];


도움말 및 지원

문제 해결에 도움이 되었나요?

피드백