Skip to content

编程猫对象存储 2025/7/19 正常服务推荐指数🌟🌟🌟已封装

更新: 7/31/2025 字数: 0 字 时长: 0 分钟

文件一键上传至编程猫七牛云对象存储,并转换成长期链接。

(好耶是白嫖,我们有救了bushi)本API已有群友封装成控件,请进入社群下载(建议使用!)

请求方式: POST 返回格式: application/json

API链接

https://api.pgaot.com/user/up_cat_file

请求参数

请求头
'Content-Type': 'application/json'
接口名称是否必填参数类型接口说明
文件必须file填写文件
路径可选string填写路径(不会你就别填!)

返回值

接口名称参数类型
integercode
urlstring
hashstring
keystring
typestring
nameinteger

正确返回示例

json
{
    "code": 200,
    "url": "https://static.codemao.cn/bcx/SymfXyb3T.png?hash=FheH7SPKYRRh8y9QqczEPITdijd4",
    "hash": "FheH7SPKYRRh8y9QqczEPITdijd4",
    "key": "bcx/SymfXyb3T.png",
    "type": "image/png",
    "name": "WindyV2[1].png",
    "size": 2322
}

错误返回示例(510)

json
{
    "code": 510,
    "msg": "文件不存在,至少选择一个文件"
}

代码参考

暂无图形化代码参考!

但是有py和GSJS的哟

sh
#Http.client
import http.client
import mimetypes
from codecs import encode

conn = http.client.HTTPSConnection("api.pgaot.com")
dataList = []
boundary = 'wL36Yn8afVp8Ag7AmP8qZ0SA4n1v9T'
dataList.append(encode('--' + boundary))
dataList.append(encode('Content-Disposition: form-data; name=file; filename={0}'.format('')))

fileType = mimetypes.guess_type('')[0] or 'application/octet-stream'
dataList.append(encode('Content-Type: {}'.format(fileType)))
dataList.append(encode(''))

with open('', 'rb') as f:
   dataList.append(f.read())
dataList.append(encode('--' + boundary))
dataList.append(encode('Content-Disposition: form-data; name=path;'))

dataList.append(encode('Content-Type: {}'.format('text/plain')))
dataList.append(encode(''))

dataList.append(encode("bcx"))
dataList.append(encode('--'+boundary+'--'))
dataList.append(encode(''))
body = b'\r\n'.join(dataList)
payload = body
headers = {
    'Content-type': 'multipart/form-data; boundary={}'.format(boundary) 
}
conn.request("POST", "/user/up_cat_file", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
sh
#Fetch
var formdata = new FormData();
formdata.append("file", fileInput.files[0], "");
formdata.append("path", "bcx");

var requestOptions = {
   method: 'POST',
   body: formdata,
   redirect: 'follow'
 };

fetch("https://api.pgaot.com/user/up_cat_file", requestOptions)
   .then(response => response.text())
   .then(result => console.log(result))
   .catch(error => console.log('error', error));

原文档没有说明返回值的接口说明哦,后续会补充!

此话写于2025/7/19

Released under the MIT License and Attribution-NonCommercial 4.0 International.