我在我的網站上使用plupload flash runtime將文件作爲附件上傳並通過電子郵件發送。該網站在Chrome瀏覽器,IE9和IE11上運行良好,但不在IE8上運行。我的大部分用戶都將使用IE8。我一直在嘗試許多不同的事情,但似乎沒有任何工作。任何人都可以請建議我任何解決方案plupload flash運行時不能在IE8上工作
這是我的JavaScript代碼,我上傳的文件發生。
modules.compose = (function() {
"use strict";
var config = {
id: '',
requestToken: $('meta[name="__AntiForgeryToken"]').attr('content'),
runtimes: 'gears,flash,silverlight,browserplus,html5',
maxFileSize: '200mb',
maxQueueSize: 10485760,
chunkSize: '1mb',
pingFrequency: 100000,
isUploaderOpen: false
},
bindUploader = function() {
$("#uploader").pluploadQueue({
// General settings
runtimes: config.runtimes,
url: '/upload.ashx' + '?id=' + config.id,
max_file_size: config.maxFileSize,
chunk_size: config.chunkSize,
unique_names: false,
headers: { '__AntiForgeryToken': config.requestToken },
// Browse filters
filters: [
{ title: "All files", extensions: "*.*" },
{ title: "Image files", extensions: "jpg,gif,png,tiff" },
{ title: "XML files", extensions: "xml" },
{ title: "PDF documents", extensions: "pdf" },
{ title: "Zip files", extensions: "zip" },
{ title: "Text files", extensions: "txt,log" },
{ title: "Powerpoint documents", extensions: "ppt,pptx,pptm,potx,potm,ppam,ppsx,ppsm,sldx,sldm,thmx" },
{ title: "Excel documents", extensions: "xls,xlsx,xlsm,xltx,xltm,xlsb,xlam" },
{ title: "Word documents", extensions: "doc,docx,docm,dotx,dotm" },
],
preinit: {
Init: function (up, info) {
$('.plupload_header, .plupload_start').remove();
}
},
init: {
UploadProgress: function (up, file) {
bumpProgress(up, file);
},
StateChanged: function (up) {
if (up.total && up.files && up.total.uploaded === up.files.length) {
var parent = $('#upload-status').parent();
$('#upload-status').fadeOut('slow').remove();
$('#send-status').appendTo(parent).fadeIn('slow');
__doPostBack('ctl00$Content$btnSendMessage', '');
}
},
FilesAdded: function (up, files) {
var i = 0;
while (i++ < up.files.length) {
$('#btnSendMessage').removeAttr("disabled");
var ii = i;
while (ii < up.files.length) {
if (up.files[i - 1].name == up.files[ii].name) {
up.removeFile(up.files[ii]);
} else {
ii++;
}
}
}
},
QueueChanged: function (up) {
if (up.total.size > config.maxQueueSize) {
$('#upload-warning-modal').modal('show');
if (up.total.queued - 1 >= 0) {
up.removeFile(up.files[up.total.queued - 1]);
}
}
}
},
// Flash settings
flash_swf_url: '/assets/js/plupload/plupload.flash.swf',
// Silverlight settings
silverlight_xap_url: '/assets/js/plupload/plupload.silverlight.xap'
});
},
bindAddAttachments = function() {
$('#btnAddAttachments').click(function (e) {
e.preventDefault();
if (!config.isUploaderOpen) {
bindUploader();
$('#uploader').show();
config.isUploaderOpen = true;
}
$(this).attr('disabled', 'disabled');
});
},
bindSendMessage = function() {
$('#btnSendMessage').click(function (e) {
e.preventDefault();
if (!Page_ClientValidate()) {
return;
}
$('.plupload_filelist_footer').css('display', 'none');
$('#uploader').block({
message: $('#upload-status'),
css: {
padding: 0,
margin: 0,
width: '50%',
top: '50%',
left: '35%',
textAlign: 'left',
color: '#000',
border: '0',
backgroundColor: 'transparent',
cursor: 'wait'
}
});
$('input[type="text"], textarea').prop('readonly', true).addClass('disabled');
$('#btnSendMessage').button('loading');
var queue = $("#uploader").pluploadQueue();
if (queue) {
queue.start();
} else {
__doPostBack('ctl00$Content$btnSendMessage', '');
}
});
},
bumpProgress = function (up, file) {
if (up.total.percent >= 80) {
$('#upload-status .progress').removeClass('progress-info').addClass('progress-success');
}
$('#upload-status .progress .bar').css('width', up.total.percent + '%');
},
bindTextareaLimit = function() {
$('#txtMessage').limit('2000', '#charsLeft');
},
initAttachmentsButton = function() {
$('#btnAddAttachments').prop('disabled', '');
},
initPing = function() {
(function ping() {
$.get("/ping.ashx");
setTimeout(ping, config.pingFrequency);
})();
};
return {
init: function (options) {
config = $.extend({}, config, options || {});
$(function() {
initAttachmentsButton();
initPing();
bindSendMessage();
bindAddAttachments();
bindTextareaLimit();
});
},
validateRecipientEmail: function (sender, args) {
var proxy = new ServiceProxy('/Default.aspx/', { async: false });
proxy.invoke(
'IsValidRecipient',
{ recipient: $('#txtRecipient').val() },
function (result) {
return (args.IsValid = result.d);
});
},
validateSenderEmail: function (sender, args) {
var proxy = new ServiceProxy('/Default.aspx/', { async: false });
proxy.invoke(
'IsValidSender',
{ sender: $('#txtSender').val() },
function (result) {
return (args.IsValid = result.d);
});
}
};
}());