热门

最新

红包

立Flag

投票

同城

我的

发布
mj_rj
MJ_RJ
3 年前
truemj_rj

js oss上传视频 据说aliyun-oss-sdk 4.4.4版本的已不维护,友友们少跳坑
/*file = e.target.files[0];
//采用时间戳重命名
var last=file.name.substr(file.name.lastIndexOf("."),file.name.length)
var fileName=Date.parse(new Date()) + last;
debugger;

client.multipartUpload("videoCourse/"+fileName, file).then(function(res) { //参数fileName为图片名称,参数file为图片
/!*!//上传成功后的图片地址
var fileUrl = res.url ? res.url : 'http://'+ res.bucket + '.oss-cn-beijing.aliyuncs.com/videoCourse/' + res.name;
console.log(fileUrl)*!/
//上传成功
var picture=document.createElement("img");
picture.setAttribute("class","upDateImg")
picture.src=fileUrl
$("#imgBox").append(picture);
//删除
$("img").on("click",function(){
console.log(this)
$(this).remove()
})
}, function() {
console.log('上传文件失败','warning');
})*/

CSDN App 扫码分享
分享
评论
点赞
打赏
  • 复制链接
  • 举报
下一条:
冒一下泡挺好看的
立即登录