阿里云OSS 对象云存储上传控件(仿百度webuploader)
1. 首先在oss控制台中,开好跨域,(见预览图文件夹中跨域图片)详情见https://help.aliyun.com/document_detail/31870.html?spm=5176.8466029.cors-info-block.1.2ef2e958WLFFqQ
var applyTokenDo = function (func) {
var url = appServer;// 请求后台获取授权地址url
return $.ajax({
url: url
}).then(function (result) {
var creds = result; //拿到相关信息,新建个client
var client = new OSS({
region: region,
accessKeyId: creds.AccessKeyId,
accessKeySecret: creds.AccessKeySecret,
stsToken: creds.SecurityToken,
bucket: bucket
});
return func(client);
});
};
若暂无后台,前端自己调测上传功能,则见4,
- 上传多个文件
- 继续添加功能
- 图片预览
- 文件MD5值计算
- ···
https://github.com/fex-team/webuploader
https://github.com/ali-sdk/ali-oss
群名称:ossUploader 群 号:516425821