腾讯云 COS 文件上传

上传本地文件到腾讯云对象存储 COS

Overview

This node uploads files to Tencent Cloud Object Storage (COS). It supports two upload modes: uploading a local file from a specified file path, or uploading HTML content by creating an HTML file and uploading it. This node is useful for automating file uploads to Tencent COS, such as backing up files, publishing HTML content, or managing cloud storage assets.

Use Case Examples

  1. Uploading a local image file to a specific bucket and path in Tencent COS.
  2. Uploading dynamically generated HTML content as a file to Tencent COS for web hosting.

Properties

Name Meaning
上传模式 选择上传模式:本地文件上传或HTML内容上传
本地文件路径 要上传的本地文件的绝对路径,仅在上传模式为本地文件上传时必填。
HTML内容 要上传的HTML内容,仅在上传模式为HTML内容上传时必填。
HTML文件名 生成的HTML文件名,仅在上传模式为HTML内容上传时必填。
存储桶名称 (Bucket) 腾讯云 COS 存储桶名称,包含 APPID,必填。
存储桶地域 (Region) 存储桶所在的地域,必填。
对象键 (Key) 文件在 COS 中的路径和名称,必填。

Output

JSON

  • success - 上传操作是否成功的布尔值
  • message - 上传结果的描述信息
  • cosResponse - 腾讯云 COS 返回的上传响应对象
  • error - 上传失败时的错误信息(仅在失败时存在)

Dependencies

  • 腾讯云 COS API 访问凭证(SecretId 和 SecretKey)

Troubleshooting

  • 确保已正确配置腾讯云 COS 的 SecretId 和 SecretKey,否则会抛出认证错误。
  • 本地文件路径必须是绝对路径且文件存在,否则上传会失败。
  • 上传 HTML 内容时,临时生成的 HTML 文件会写入当前工作目录,确保有写权限。
  • 上传失败时,错误信息会包含在输出中,便于排查问题。

Discussion