Skip to content

v1.0.5 增加json传base64字符串

Latest

Choose a tag to compare

@mofanx mofanx released this 10 Dec 07:39

方式一:HTTP 上传接口

1)form-data 上传文件

curl -H "Authorization: Bearer your_api_key1" -F "file=@本地图片路径.jpg" http://localhost:3000/api/upload

2)JSON 传 base64 字符串

curl -H "Authorization: Bearer your_api_key1" \
     -H "Content-Type: application/json" \
     -d '{
           "base64": "data:image/png;base64,iVBORw0...",
           "filename": "demo.png",
           "mimeType": "image/png"
         }' \
     http://localhost:3000/api/upload

字段说明:

  • base64 / fileBase64 / data:三选一,传入 base64 字符串或 data URL,必填
  • filename / name / fileName:可选,默认自动生成
  • mimeType / mimetype / contentType / type:可选,默认从 data URL 或文件内容推断