var xhr = new XMLHttpRequest();
xhr.open('GET', "http://abc/a.jpg");
xhr.responseType = 'blob';
xhr.onload = function(){
var content = xhr.response;
var blob = new Blob([content]);//blob.type=''
var file2 = new File([blob], 'test.png', {type: 'image/png'});
let formData = new FormData();
formData.append('file',file2 );
//上传接口
}

posted on 2020-07-31 10:03  二豆  阅读(1205)  评论(0编辑  收藏  举报