原因说是因为 ie8,ie9 当使用 html4 runtime,但是html4的机制 导致 根本没办法获取文件大小。
所以方式是 使用 flash或者 silverlight ,但是我参考下面这篇文章的写法,还是不行。我去访问他们的官网说,我的falsh不支持,实际上我的falsh是好的。
感觉这是一个bug,网上貌似有处理这个问题(https://github.com/moxiecode/plupload/issues/323
https://github.com/moxiecode/plupload/commit/070e8a454affba3fc452665a587355d6789fb388
),但是好像是老版本的,测试没能成功。先到这里吧。后面再说。
参考:https://github.com/moxiecode/plupload/issues/985
Still not working on ie8 in XP #985
Version of Plupload that is used on Example pages at the moment is old and deprecated. Better test on one of the bundled examples from the 2.1 package.
Hi..
Try to view the following: http://jsfiddle.net/gbLyN/
and got this:
Any suggestions?
Do you have simple html page with 2.1 version to try it out?
Unfortunately jsfiddle doesn't work for old IEs: jsfiddle/jsfiddle-issues#450.
Website has been updated now, and examples upgraded to Plupload 2.1.
What exactly doesn't work?..
Site wasn't optimized for old IEs, sorry for that. It mostly is now (I've dropped out from IE6 though). Otherwise everything seems to be working ok. Flash/Silverlight do not load for you 'cause you probably do not have them in that browser. N/A in HTML4 is ok, 'cause HTML4 has no idea what the file size is and no tools to get it.
Ok... now it works just fine in the flash example in plupload.com..
But still, when i'm running the 2.1 version in my plupload.. it wont work..
Can you see something that i dont?
/* Uploader init */
$("#uploader").pluploadQueue({
// General settings
runtimes: 'flash,html5,silverlight,html4',
browse_button: 'uploader_browse',
url: UploadbigfilesServiceAddress + 'plupload/Handlers/UploadfilesLogic.ashx',
max_file_size: PL_Max_File_Size,
chunk_size: PL_Chunk_Size,
max_retries: PL_Max_Retries,
send_chunk_number: false,
unique_names: true,
rename: false,
dragdrop: true,
// Flash/Silverlight paths
flash_swf_url: UploadbigfilesServiceAddress + 'plupload/js/Moxie.swf',
silverlight_xap_url: UploadbigfilesServiceAddress + 'plupload/js/Moxie.xap',
// PreInit events, bound before any internal events
preinit: {
Init: function (up, info) {
log('[Init]', 'Info:', info, 'Features:', up.features);
if (StartButtonLocation == 'he-il') {
$('.plupload_add').css({ 'position': 'relative', 'right': '80px', 'cursor': 'pointer' });
$('.plupload_progress').css('direction', 'rtl');
$('.plupload_upload_status').css('direction', 'rtl');
}
$('.plupload_upload_status').css('font-size', '12px');
SetUploaderClearButton(ClearButtonValue, StartButtonLocation);
SetStartButtonLocation(StartButtonLocation);
/* uploader custom actions & ui */
$('#uploader_clearlist').css('visibility', 'hidden');
$('#canDel').css('visibility', 'hidden');
$('#uploader_clearlist, #canDel').click(function (e) {
e.preventDefault();
$("#uploader").pluploadQueue().splice();
SetDisplayFields('hidden');
});
//add timer
$('.plupload_progress').after('<div class="plupload_file_time"></div>');
/* custom button events & validations */
},
UploadFile: function (up, file) {
log('[UploadFile]', file);
// You can override settings before the file is uploaded
}
},
// Post init events, bound after the internal events
init: {
Refresh: function (up) {
// Called when upload shim is moved
log('[Refresh]');
},
StateChanged: function (up) {
// Called when the state of the queue is changed
log('[StateChanged]', up.state == plupload.STARTED ? "STARTED" : "STOPPED");
if (up.state == plupload.STARTED) {
$('#uploader_filelist').scrollTop($('#uploader_filelist li:nth-child(1)').position().top);
totalHeight = $("#uploader_filelist")[0].scrollHeight;
if (Number(totalHeight) > 185) {
IsScroll = true;
}
document.title = StartTitle;
}
if (up.state == plupload.DONE) {
document.title = FinishTitle;
}
},
QueueChanged: function (up) {
// Called when the files in queue are changed by adding/removing files
log('[QueueChanged]');
var iter = 0;
while (iter < up.files.length) {
if (up.files[iter].name.indexOf('.') == -1 && up.files[iter].size % 4096 == 0) {
alert(NoFolders);
up.splice(iter, 1); //remove the file from the queue
}
iter++;
}
SetFields(up);
if (IsGood) {
if (up.total.queued > 0) {
$('#uploader_clearlist').css('visibility', 'visible');
$('#canDel').css('visibility', 'visible');
$('.plupload_start').show();
}
else {
$('#uploader_clearlist').css('visibility', 'hidden');
$('#canDel').css('visibility', 'hidden');
$('.plupload_start').hide();
}
}
},
BeforeUpload: function (up, file) {
up.settings.multipart_params = {
original_name: file.name,
maillConfirmationCode: maillConfirmationCode,
mailSessionId: mailSessionId,
mailSessionIdBigInt: mailSessionIdBigInt
};
},
UploadProgress: function (up, file) {
// Called while a file is being uploaded
log('[UploadProgress]', 'File:', file, "Total:", up.total);
document.title = up.total.percent + UploadProgress;
$('.plupload_file_time').html(TimeLeft + ': ' + SecondsToTime((up.total.size - up.total.loaded) / up.total.bytesPerSec));
},
FilesAdded: function (up, files) {
// Callced when files are added to queue
log('[FilesAdded]');
if (StartButtonLocation == 'he-il') {
$('.plupload_clearlist').css({ 'left': '100px' });
}
plupload.each(files, function (file) {
log(' File:', file);
if (up.state != '1') {
up.removeFile(file);
}
});
var invalidFiles = '';
for (var i = 0; i < up.files.length; i++) {
if (checkChars(up.files[i].name)) {
invalidFiles += escape(up.files[i].name) + '<br/>';
}
}
IsGood = true;
if (invalidFiles.length > 0) {
$("#uploader").pluploadQueue().splice();
SetDisplayFields('hidden');
$('#uploader_clearlist').css('visibility', 'hidden');
$('#canDel').css('visibility', 'hidden');
$('.plupload_start').hide();
$('#uj_invalids').html($('#uj_invalids').html().replace('#F#', invalidFiles + '<br/>'));
RedirectionFloating($("#InvalidFileName"), true);
IsGood = false;
}
},
FilesRemoved: function (up, files) {
// Called when files where removed from queue
log('[FilesRemoved]');
plupload.each(files, function (file) {
log(' File:', file);
});
},
FileUploaded: function (up, file, info) {
// Called when a file has finished uploading
log('[FileUploaded] File:', file, "Info:", info);
if (IsScroll) {
for (var i in up.files) {
if (up.files[i].id == file.id) {
var offset = $('#' + file.id)[0].scrollHeight;
updaterHeight += (offset + 1);
$('#uploader_filelist').scrollTop(updaterHeight).position().top;
break;
}
}
}
},
ChunkUploaded: function (up, file, info) {
// Called when a file chunk has finished uploading
log('[ChunkUploaded] File:', file, "Info:", info);
},
UploadComplete: function (up, files) {
SetFields(up);
// Called when all files in a queue are uploaded.
log('[UploadComplete]');
var Complete = false;
if (up.files.length > 0) {
if (up.total.failed == 0 && up.total.queued == 0) {
Complete = true;
}
else {
if (curTry >= maxTry) {
for (i = 0 ; i < up.files.length; i++) {
var file1 = up.files[i];
if (file1.status == plupload.FAILED) {
RegisterErrorfiletoDatabase(mailSessionId, mailSessionIdBigInt, maillConfirmationCode, file1.name, file1.target_name, file1.loaded);
}
}
Complete = true;
}
else {
for (i = 0 ; i < up.files.length; i++) {
var file2 = up.files[i];
if (file2.status == plupload.FAILED) {
file2.status = plupload.QUEUED;
}
}
curTry++;
up.start();
}
}
if (Complete) {
UploadComplete(mailSessionId, mailSessionIdBigInt, maillConfirmationCode, up.total.loaded, up.runtime);
}
}
},
Error: function (up, args) {
// Called when a error has occured
// Handle file specific error and general error
if (args.file) {
log('[error]', args, "File:", args.file);
}
else {
log('[error]', args);
}
}
}
});
$('#log').val('');
});
Attached some screen shots from TeamViewer..
adding files and.... N/A for all of them. This also what happend to all my clients, and this is way i redirect them to the 1.5.7 version..
for the rest of the examples i see:
but i have flash, for example, can see some youtube:
Any idea how yo solve it? the retry chunks is very impotent..
Thanks!