我有一些问题
我在jquery中创建了blob和wekitslice方法。这对Mozilla,opera和chrome浏览器完全有效,但在safari浏览器中不支持
关注我的jquery代码:
var blob = document.getElementById('fileToUpload').files[0];
var BYTES_PER_CHUNK = 1048576; // 1MB chunk sizes.
var SIZE = blob.size;
BYTES_PER_CHUNK=Math.round(SIZE/100);
var start = 0;
var end = BYTES_PER_CHUNK;
window.uploadcounter=0;
window.uploadfilearray = [];
while( start < SIZE )
{
if(typeof blob.slice === 'function')
{
var chunk = blob.slice(start, end);// if mozill,opera and chrome this condition call
}else if(typeof blob.webkitSlice === 'function')//this not perform condition use safari
{
var chunk = blob.webkitSlice(start, end);
}
window.uploadfilearray[window.uploadcounter]=chunk;
window.uploadcounter=window.uploadcounter+1;
start = end;
end = start + BYTES_PER_CHUNK;
}
这个问题任何解决方案???