tencent cloud

Smart Media Hosting

Product Introduction
Product Overview
Feature Description
Product Strengths
Use Cases
Basic Concept
Purchase Guide
Quick Start
Create Media Library
Initiate request
Service Level API Document
History
Introduction
API Category
Making API Requests
PaaS Service APIs
Official Cloud Disk APIs
Data Types
Error Codes
Business Level API Document
Introduction
Access Token Operation API
Tenant Space Operation API
File Operation API
Directory or Album Operation API
Recycle Bin Operation API
Quota Operation API
Query Task Operation API
Search Operation API
Historical Version Operations API
Directory and File Batch Operation API
Collection Operation API
Error Codes
SDK Documentation
Android SDK
iOS SDK
HarmonyOS SDK
FAQs
Enterprise Network Disk
Product Introduction
Purchase Guide
Quick Start
FAQs
Service Level Agreement
Glossary

Copying a Single File

PDF
Mode fokus
Ukuran font
Terakhir diperbarui: 2026-01-07 10:49:07

Introduction

This document provides an API overview about file renaming and SDK sample code.
API
Operation Description
Renaming a file

SDK API Reference

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

Renaming a file

Feature Description

Use to rename a file.

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";
// Destination filename
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 file when conflicts with
/// overwrite: Returns HTTP 409 Conflict and error code SameNameDirectoryOrFileExists when accessing the root directory, otherwise overwrites the existing file;
req.conflictStrategy = QCloudSMHConflictStrategyEnumOverWrite;
[req setFinishBlock:^(QCloudSMHRenameResult *result, NSError *_Nullable error) {
}];
[[QCloudSMHService defaultSMHService] renameFile:req];


Bantuan dan Dukungan

Apakah halaman ini membantu?

masukan