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

Completing File Upload

PDF
フォーカスモード
フォントサイズ
最終更新日: 2026-01-07 14:15:06

Description

Used for file upload.
Note:
Required permissions: admin, space_admin, upload_file, upload_file_force, or confirm_upload. For details about permissions, see Generate Access Token API.
After the form upload is completed, be sure to call this interface promptly; otherwise, the file cannot be stored correctly.
If this interface is called when file upload has not actually been completed, an error message will be returned.

Request

Request Example

POST /api/v1/file/`{LibraryId}`/`{SpaceId}`/`{ConfirmKey}`?confirm&conflict_resolution_strategy=`{ConflictResolutionStrategy}`&access_token=`{AccessToken}`&user_id=`{UserId}&with_inode={WithInode}`

Request Parameter

Request parameters.
Description
Type
Required or Not
LibraryId
Media Library ID, obtained after creating a media library in the media hosting console. See Create Media Library
String
Yes
SpaceId
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. See Create Tenant Space
String
No
ConfirmKey
Confirm parameters, specified as the field value of confirmKey in the response body when uploading files.
String
Yes
ConflictResolutionStrategy
Handling method when filename conflict, defaults to 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 conflicts with accessing the root directory, otherwise overwrites existing file, defaults to ConflictResolutionStrategy specified at file upload start.
String
No
AccessToken
Access token, see Generate Access Token to obtain
String
Yes
UserId
User identity recognition. When the access token has admin permission and the user identity recognition during token application is empty, it is used to temporarily designate user identity. For details, see Generate Access Token API
String
No
WithInode
0 or 1, whether to return inode (file directory ID), default do not return
String
No

Request Body

Empty or application/json, specify crc64 used for verification of upload correctness.
Request body example:
{
"crc64": "xxx",
"labels":["elephant","animal","Asian elephant"],
"category":"video",
"localCreationTime": "2022-07-26T02:58:09Z",
"localModificationTime": "2022-07-26T02:58:09Z"
}
Request body field description:
Request parameters.
Description
Type
Required or Not
crc64
The CRC64-ECMA182 check value of the file. If not specified, do not validate. If verification fails, return HTTP 400 Bad Request with the BadCrc64 error code.
String
No
labels
File Tag List
String Array
No
category
Customized Category
String
No
localCreationTime
File Local Creation Time
String
No
localModificationTime
File local modification time
String
No

Response

Response code

Upload succeeded, return HTTP 200 OK.

Response Body

application/json
Response body example:
{
"path": [ "foo", "bar", "file (1).docx" ],
"name": "file (1).docx",
"type": "file",
"inode": "b63393076d249110000631c316d9751a",
"creationTime": "2020-09-22T07:44:45.000Z",
"modificationTime": "2021-02-01T08:21:47.000Z",
"contentType": "image/jpg",
"size": "1048576",
"eTag": "xxx",
"crc64": "xxx",
"metaData": {
"x-smh-meta-foo": "bar"
},
"virusAuditStatus": 0,
"isOverwritten": false,
"previewByDoc": true,
"previewByCI": true,
"previewAsIcon": false,
"fileType": "word"
}
Response body field description:
Response Parameters
Description
Type
path
String array or null
If it is an array of strings, it indicates the final file path. The last element in the array represents the final file name, and the other elements represent each first-level directory name. Because files with the same name may exist and be renamed automatically, the final path here may not equal the designated path when uploading starts.
If it is null, it means that the directory where the file resides or a certain parent directory has been deleted, and the file can no longer be accessed.
String
name
Final file name
String Array
type
File type
String
inode
File directory ID
String
creationTime
The time when the file is uploaded for the first time
String
modificationTime
Last overwrite time of the file
String
contentType
media type
String
size
File size.
String
eTag
File eTag
String
crc64
File CRC64-ECMA182 check value
String
metaData
metadata, if there is no metadata this field does not exist
String
isOverwritten
Whether file overwrite occurred during file upload
Array
previewByDoc
Whether WPS can preview the file
Boolean
previewByCI
Whether Wanxiang can preview the file
Boolean
previewAsIcon
Use preview image as icon
Boolean
fileType
File type: Excel, PowerPoint
String
virusAuditStatus
0-6 Virus scan status:
0: not detected (Folder does not tag as suspicious and remains 0)
1: detecting
2: risk-free
3: risk file(s)
4: Unable to detect (such as file too large exceeding detection range, treated as risk-free on client side) (files over 1GB not detected)
5: Manually marked as risk-free
6: Detect task failed
String

Error Codes

This request operation has no special error messages. For common error messages, see Error Codes.

ヘルプとサポート

この記事はお役に立ちましたか?

フィードバック