登录有首页可见
参数名 | 类型 | 是否必须 | 参数说明 |
---|---|---|---|
file | file | 是 | 支持jpg/jgeg/png/gif/bmp/webp格式 |
token | string | 否 | 建议使用这种方式,因为游客上传有限制 |
如果请求成功,返回结果如下
{
"code": 200,
"delete": "http://img.iqismart.com/delete/e1af4585a0c63777",
"height": 900,
"id:" 24,
"imgid": "515dba16592932b6",
"relative_path": "/imgs/2021/11/515dba16592932b6.jpeg",
"thumbnail_url": "http://img.iqismart.com/imgs/2021/11/515dba16592932b6_thumb.jpeg",
"url": "http://img.iqismart.com/imgs/2021/11/515dba16592932b6.jpeg",
"width": 600
}
参数名 | 类型 | 参数说明 |
---|---|---|
code | int | 状态码,200:成功,0:失败 |
id | int | id(唯一) |
imgid | string | 图片id(唯一) |
relative_path | string | 图片相对路径 |
url | string | 图片URL |
thumbnail_url | string | 缩略图URL |
width | int | 图片宽 |
height | int | 图片高 |
delete | string | 图片删除链接,若此图片之前已上传过,返回空 |
如果失败,返回结果为
{"code":0,"msg":"The filetype you are attempting to upload is not allowed."}
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title>SmartIMG上传测试</title>
<meta name="generator" content="EverEdit" />
<meta name="author" content="" />
<meta name="keywords" content="" />
<meta name="description" content="" />
</head>
<body>
<form enctype="multipart/form-data" method="post" action="http://img.iqismart.com/api/upload" id="upform">
<input type="file" name="file" class="up-file">
<input type="submit" id="btn" value="开始上传" class="btn">
</form>
</body>
</html>