function createXmlHttpRequestObject() {
if (window.ActiveXObject) {
try{
xmlHttp=new ActiveXObject("Microsoft.XMLHttp");
}catch(e){
xmlHttp=false;
}
}else{
try{
xmlHttp=new XMLHttpRequest();
}catch(e){
xmlHttp=false;
}
}
if (!xmlHttp)
alert('返回创创建的对象或错误信息');
else
return xmlHttp;
}
function ReqHtml(file) {
createXmlHttpRequestObject();
xmlHttp.onreadystatechange=StatHandler;
xmlHttp.responseType = 'blob';
xmlHttp.open("GET",file,true);
xmlHttp.send(null);
}
function StatHandler() {
if (xmlHttp.readyState==4&&xmlHttp.status==200) {
var file=new File([xmlHttp.response],'index.mp3',{type: 'audio/mp3'});
cos.putObject({
Bucket: Bucket, // Bucket 格式:test-1250000000
Region: Region,
Key: 'key_index.mp3',
Body: file,
TaskReady: function (tid) {
TaskId = tid;
},
onProgress: function (progressData) {
//console.log(JSON.stringify(progressData));
},
},
function (err, data) {
if(data.statusCode==200)
{
$.getCosUrl('key_index.mp3');
}
});
}
}
上传xml http
最新推荐文章于 2022-05-10 13:56:49 发布