上传图片
Web 界面
登录后拖拽文件或点击上传。Web UI 支持批量上传,上传成功后自动复制分享链接。
curl
# 认证上传
curl -X POST http://localhost:18080/api/v1/images \
-H "Authorization: Bearer YOUR_TOKEN" \
-F "file=@image.png"
# 设置过期时间(24 小时)
curl -X POST http://localhost:18080/api/v1/images \
-H "Authorization: Bearer YOUR_TOKEN" \
-F "file=@image.png" \
-F "expires_in=24h"
# 游客上传(需在管理后台启用游客上传功能)
curl -X POST http://localhost:18080/api/v1/upload \
-F "file=@image.png" ShareX
PicFast 内置 ShareX 配置端点。详细设置请参阅 ShareX 集成页面。
其他工具
PicFast 同时支持 PicGo、PicList、uPic、Dropshare,以及任何兼容标准 REST 上传端点的工具。管理后台的 接入方式 页面为每款工具提供了分步设置指南,还包含 Obsidian(通过 Image auto upload + PicGo)的配置说明。
MCP(AI Agent)
AI 助手可通过 PicFast 的 MCP 服务器上传图片。完整的安装与配置说明请参阅 MCP 集成页面。
Python
import requests
url = "https://pics.example.com/api/v1/images"
headers = {"Authorization": "Bearer YOUR_TOKEN"}
with open("image.png", "rb") as f:
files = {"file": f}
r = requests.post(url, headers=headers, files=files)
print(r.json()["links"]["url"]) JavaScript
const form = new FormData();
const file = await fs.openAsBlob("image.png");
form.append("file", file);
const res = await fetch("https://pics.example.com/api/v1/images", {
method: "POST",
headers: { "Authorization": "Bearer YOUR_TOKEN" },
body: form,
});
const data = await res.json();
console.log(data.links.markdown); 响应格式
上传成功后返回的 JSON 示例:
{"id": 1,"key": "abc123","origin_name": "image.png",
"size_bytes": 204800,"mimetype": "image/png","extension": "png",
"width": 1920,"height": 1080,
"links": {"url": "https://pics.example.com/i/abc123.png",
"html": "<img src=\"https://pics.example.com/i/abc123.png\" />",
"markdown": "",
"bbcode": "[img]https://pics.example.com/i/abc123.png[/img]",
"thumbnail_url": "https://pics.example.com/t/abc123.png"},
"created_at": "2026-05-02T00:00:00Z"} 支持的格式与限制
支持的格式:jpg、png、gif、webp、svg、bmp、ico。
单文件最大体积按分组配置,默认 50 MB。
游客上传的过期时间可通过 app.guest_image_ttl 单独设置,适合给游客上传设置比登录用户更短的生命周期。详见 配置参考。