Uploadify OnAllComplete with alert crashes FF4
I have implemented on my page the Uploadify plugin and I am having some trouble with the onAllComplete event with Firefox 4.
I have it implemented like this:
$(document).ready(function() {
$('#file_upload').uploadify({
'uploader' : 'js/uploadify.swf',
'script' : 'UploadVarios.ashx',
'cancelImg' : 'js/cancel.png',
'folder' : '/uploads',
'multi' : true,
'auto' : true,
'buttonText' : 'Escolher ficheiros',
'removeCompleted' : false,
'fileExt' : '*.doc;*.docx;',
'fileDesc' : 'Ficheiros Word',
onError : function (event,ID,fileObj,errorObj) {
document.forms["form1"].elements["nroErros"].value = 1
}
,
onAllComplete : function(event,data) {
if(document.forms["form1"].elements["nroErros"].value > 0) {
alert('ERROR!');
开发者_开发知识库 document.forms["form1"].elements["nroErros"].value = 0;
}
}
});
});
The idea is that if any of the files to be uploaded reports an error, at the end of the upload task an alert message appears. This works well on IE and on Chrome, but on FF4 after showing the alert and when i try to click on the OK, FF crashes completely. Any idea on what's going on here?
AS far as I can tell this is a problem related to the alert of Javascript and Firefox 4 and not related to Uploadify itself.
I ended up removing the alert, adding a div on my page and modifying the div content on error. Not the prettiest job but it works at least on all 3 major browsers.
I had the same problem with Firefox 5 and Uploadify. If you have Firebug installed and if you're just using the alert for debugging during development, you could replace alert('ERROR!');
with console.log('ERROR!');
精彩评论