我将制作文件上传图片预览系统 我使用URL.createObjectURL方法 这个方法的返回类型是' blob:http://~~'在铬 但即返回的是blob:AB0CC6B1- ~~' 所以我无法解析输入图像
function onFileAllChanged(event){
var sizeArray=document.getElementById('fileAllUploadButton').files;
if(sizeArray.length==0){
return;
}else if(sizeArray.length>5){
alert('사진은 최대 5장까지 입니다.')
return;
}
for(var i=0;i<5;i++){
var sizeImage = new Image();
sizeImage.onload = function(){
var width = this.width;
var height = this.height;
if(3000<width||3000<height){
alert("이미지의 사이즈나 용량이 너무 큽니다.")
while(fileList.length!=0){
fileList.pop();
}
for(var resetIndex=0;resetIndex<5;resetIndex++){
$('.subImage .subImageControllerBox:eq(' + resetIndex + ')').css('background-image', 'none');
$('.subImage .subImageControllerBox:eq(' + resetIndex + ')').attr('image-path','none');
$('.subImage .subImageControllerBox:eq(' + resetIndex + ')').attr('image-filter','none');
}
return;
}
};
var path = window.URL.createObjectURL(sizeArray[i]);
console.log('temp:'+path);
sizeImage.src=path;
}
var getFormFile = document.getElementById('fileAllUploadButton').files;
while(fileList.length!=0){
fileList.pop();
}
for(var k=0;k<getFormFile.length;k++){
fileList.push(getFormFile[k]);
}
for(var i=0;i<5;i++) {
var path = URL.createObjectURL(fileList[i]);
if(i==0){
viewScreenImages(path,"default",i);
}
if(fileList[i]!=undefined) {
$('.subImage .subImageControllerBox:eq(' + i + ')').css('background-image', 'url(' + path + ')');
$('.subImage .subImageControllerBox:eq(' + i + ')').attr('image-path',path);
$('.subImage .subImageControllerBox:eq(' + i + ')').attr('image-filter','default');
}else{
$('.subImage .subImageControllerBox:eq(' + i + ')').css('background-image', 'none');
$('.subImage .subImageControllerBox:eq(' + i + ')').attr('image-path','none');
$('.subImage .subImageControllerBox:eq(' + i + ')').attr('image-filter','none');
}
}
}
如何解决?