If I upload images in two places on a page but I think their keys are different, how can I separate them without conflict? My current approach is to create two files
var uploader1= Qiniu.uploader({
'Key': function(up, file) {
var now = new Date();
var date = now.getFullYear()+((now.getMonth()+1)<10?"0":"")+(now.getMonth()+1)+(now.getDate()<10?"0":"")+now.getDate();
return "topic/cover/"+date;
},
})
var uploader2= Qiniu.uploader({
'Key': function(up, file) {
var now = new Date();
var date = now.getFullYear()+((now.getMonth()+1)<10?"0":"")+(now.getMonth()+1)+(now.getDate()<10?"0":"")+now.getDate();
return "topic/banner/"+date;
},
})
})
But why will the keys be the same if we do this?
伊谢尔伦2017-06-22 11:56:16
I know, it turns out that it needs to be instantiated
var Qiniu1 = new QiniuJsSDK()
var Qiniu2 = new QiniuJsSDK()
var uploader1= Qiniu1 .uploader({})
var uploader2= Qiniu2 .uploader({})