惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

K
Kaspersky official blog
V
Visual Studio Blog
宝玉的分享
宝玉的分享
月光博客
月光博客
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Y
Y Combinator Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
大猫的无限游戏
大猫的无限游戏
H
Help Net Security
博客园_首页
Recent Announcements
Recent Announcements
小众软件
小众软件
MongoDB | Blog
MongoDB | Blog
Attack and Defense Labs
Attack and Defense Labs
The GitHub Blog
The GitHub Blog
Google DeepMind News
Google DeepMind News
Cisco Talos Blog
Cisco Talos Blog
L
LINUX DO - 最新话题
V2EX - 技术
V2EX - 技术
Simon Willison's Weblog
Simon Willison's Weblog
P
Palo Alto Networks Blog
PCI Perspectives
PCI Perspectives
T
Troy Hunt's Blog
Hacker News: Ask HN
Hacker News: Ask HN
S
Security Affairs
量子位
The Register - Security
The Register - Security
腾讯CDC
T
The Exploit Database - CXSecurity.com
P
Privacy & Cybersecurity Law Blog
V
Vulnerabilities – Threatpost
L
LINUX DO - 热门话题
N
News and Events Feed by Topic
Cloudbric
Cloudbric
Cyberwarzone
Cyberwarzone
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Recent Commits to openclaw:main
Recent Commits to openclaw:main
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
D
Darknet – Hacking Tools, Hacker News & Cyber Security
TaoSecurity Blog
TaoSecurity Blog
Scott Helme
Scott Helme
C
Cybersecurity and Infrastructure Security Agency CISA
The Last Watchdog
The Last Watchdog
W
WeLiveSecurity
H
Hacker News: Front Page
T
Tor Project blog
C
Cyber Attacks, Cyber Crime and Cyber Security
NISL@THU
NISL@THU
Know Your Adversary
Know Your Adversary
C
CXSECURITY Database RSS Feed - CXSecurity.com

博客园 - 伽马科技.攻城师

管理git生成的多个ssh key Docker基础教程(命令详解) Docker基础教程(常用命令篇) Docker基础教程(安装篇) 常用的Jquery插件 自定义webkit浏览器滚动条样式 centos tar压缩与解压缩命令大全 Nginx编译安装(Centos) Nginx的启动脚本(Centos) ffmpeg 音频转换(amr2mp3) 安装php openssl扩展 centos手动编译安装apache、php、mysql 添加自编译的apache为linux系统服务 Jquery datatables 使用方法 HTML5 图片缩放功能 2015年12月中国航空公司名录 HTML5 开发框架 利用HTML5定位功能,实现在百度地图上定位 openerp7 时区问题
七牛图片上传JSSDK
伽马科技.攻城师 · 2016-04-08 · via 博客园 - 伽马科技.攻城师

BASE64图片上传

接口说明:

POST /putb64/<Fsize>/key/<EncodedKey>/mimeType/<EncodedMimeType>/crc32/<Crc32>/x:user-var/<EncodedUserVarVal>
Host: upload.qiniu.com
Authorization: UpToken <UpToken>
Content-Type: application/octet-stream

<Base64EncodedFileContent>
  • <Fsize>: 必选,文件大小,没经过base64处理的原图的字节大小,支持传入 -1 表示文件大小以 http request body 为准。

  • <EncodedKey>: 可选,如果没有指定则:如果 uptoken.SaveKey 存在则基于 SaveKey 生产 key,否则用 hash 值作 key。

  • <EncodedMimeType>:可选, 文件的 MIME 类型,默认是 application/octet-stream。

  • <Crc32>: 可选,文件内容的 crc32 校验值,不指定则不进行校验。

  • Authorization:UpToken与后面的字符串保留一个空格。后面跟上你在服务端请求的token的字符串。

举例:

function putb64(){    
  var pic = "base64后的图片字符串";
  var url = "http://up.qiniu.com/putb64/20264";
  var xhr = new XMLHttpRequest();
  xhr.onreadystatechange=function(){
    if (xhr.readyState==4){
        document.getElementById("myDiv").innerHTML=xhr.responseText; } } xhr.open("POST", url, true); xhr.setRequestHeader("Content-Type", "application/octet-stream"); xhr.setRequestHeader("Authorization", "UpToken 从服务端获取的上传token"); xhr.send(pic); }