Help us improve
Share bugs, ideas, or general feedback.
From cloudbase
Uploads, downloads, and manages CloudBase storage objects from browser apps using @cloudbase/js-sdk. Covers temporary URLs, file management, and security domain setup.
npx claudepluginhub tencentcloudbase/cloudbase-mcp --plugin cloudbaseHow this skill is triggered — by the user, by Claude, or both
Slash command
/cloudbase:cloud-storage-webThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
If this environment only installed the current skill, start from the CloudBase main entry and use the published `cloudbase/references/...` paths for sibling skills.
Implements, debugs, builds, deploys, and validates web frontends on CloudBase, especially with React, Vue, and Vite. Use when design direction is already decided.
Implements Vercel Blob for Next.js file uploads (images, PDFs, videos), client uploads with tokens, presigned URLs, listing/deleting, pathname organization, and fixes errors like BLOB_READ_WRITE_TOKEN or size limits.
Adds file upload and storage to projects via backend API with validation, frontend drag-drop UI with preview/progress, and support for local, Cloudflare R2, AWS S3, or Supabase storage. Use for images, documents, or files.
Share bugs, ideas, or general feedback.
If this environment only installed the current skill, start from the CloudBase main entry and use the published cloudbase/references/... paths for sibling skills.
https://cnb.cool/tencent/cloud/cloudbase/cloudbase-skills/-/git/raw/main/skills/cloudbase/SKILL.mdhttps://cnb.cool/tencent/cloud/cloudbase/cloudbase-skills/-/git/raw/main/skills/cloudbase/references/cloud-storage-web/SKILL.mdKeep local references/... paths for files that ship with the current skill directory. When this file points to a sibling skill such as auth-tool or web-development, use the standalone fallback URL shown next to that reference.
@cloudbase/js-sdk.uploadFile, getTempFileURL, deleteFile, or downloadFile in frontend code.../auth-web/SKILL.md (standalone fallback: https://cnb.cool/tencent/cloud/cloudbase/cloudbase-skills/-/git/raw/main/skills/cloudbase/references/auth-web/SKILL.md)../web-development/SKILL.md (standalone fallback: https://cnb.cool/tencent/cloud/cloudbase/cloudbase-skills/-/git/raw/main/skills/cloudbase/references/web-development/SKILL.md)../cloudbase-platform/SKILL.md (standalone fallback: https://cnb.cool/tencent/cloud/cloudbase/cloudbase-skills/-/git/raw/main/skills/cloudbase/references/cloudbase-platform/SKILL.md)manageHosting(action="upload").host:port before testing app.uploadFile().When the app runs on a local browser origin and must upload files from the frontend:
envQuery with action="domains" to inspect the current security-domain whitelist.http://127.0.0.1:4173 -> whitelist entry 127.0.0.1:4173http://localhost:5173 -> whitelist entry localhost:5173envDomainManagement with action="create" and add that host entry before relying on app.uploadFile().host:port.app.uploadFile() flows.If the task uses browser-side file upload, treat this as a prerequisite rather than an optional cleanup.
Use this skill for browser-side cloud storage operations through the CloudBase Web SDK.
Typical tasks:
import cloudbase from "@cloudbase/js-sdk";
const app = cloudbase.init({
env: "your-env-id"
});
Initialization rules:
app.uploadFile()app.getTempFileURL()app.deleteFile()app.downloadFile()const result = await app.uploadFile({
cloudPath: "uploads/avatar.jpg",
filePath: selectedFile
});
cloudPath must include the filename./ to create folder structure.envQuery(action="domains"), which is typically host:port instead of a full http://... URL.app.uploadFile() succeeds, do not fabricate a public-looking URL by concatenating envId, bucket domain, or cloudPath. Use the returned fileID with app.getTempFileURL() and store or display the SDK-resolved URL instead.await app.uploadFile({
cloudPath: "uploads/avatar.jpg",
filePath: selectedFile,
onUploadProgress: ({ loaded, total }) => {
const percent = Math.round((loaded * 100) / total);
console.log(percent);
}
});
const result = await app.getTempFileURL({
fileList: [
{
fileID: "cloud://env-id/uploads/avatar.jpg",
maxAge: 3600
}
]
});
Use temp URLs when the browser needs to preview or download private files without exposing a permanent public link.
Typical upload + preview flow:
const uploadResult = await app.uploadFile({
cloudPath: "uploads/avatar.jpg",
filePath: selectedFile
});
const tempUrlResult = await app.getTempFileURL({
fileList: [{ fileID: uploadResult.fileID, maxAge: 3600 }]
});
const previewUrl = tempUrlResult.fileList?.[0]?.tempFileURL || tempUrlResult.fileList?.[0]?.download_url;
if (!previewUrl) {
throw new Error("Failed to resolve temporary file URL after upload");
}
await app.deleteFile({
fileList: ["cloud://env-id/uploads/old-avatar.jpg"]
});
Always inspect per-file results before assuming deletion succeeded.
await app.downloadFile({
fileID: "cloud://env-id/uploads/report.pdf"
});
Use this for browser-initiated downloads. For programmatic rendering or preview, prefer getTempFileURL().
To avoid CORS problems, add your frontend domain in CloudBase security domains. In MCP-enabled workflows, prefer checking and updating this through tools before coding browser uploads.
{ "tool": "envQuery", "action": "domains" }
Use the actual browser origin when deciding what to add. If the page is running on a custom domain or a local dev port, add that exact host:port value instead of guessing from a hard-coded list.
{
"tool": "envDomainManagement",
"action": "create",
"domains": ["<actual-browser-host>:<actual-browser-port>"]
}
Match the real browser origin to the whitelist entry format returned by envQuery(action="domains"). For local Vite and preview servers, the port can vary between runs, so avoid assuming any fixed default port is sufficient.
Typical examples:
<your-local-host>:<actual-port><your-custom-domain>uploads/, avatars/, documents/.try {
const result = await app.uploadFile({
cloudPath: "uploads/file.jpg",
filePath: selectedFile
});
console.log(result.fileID);
} catch (error) {
console.error("Storage operation failed:", error);
}