我使用 uploader 创建了一个页面。作为上传者,我使用 Uploadify 3。该代码适用于除 IE9 之外的所有浏览器。当我将 IE 9 设置为兼容模式时,它可以正常工作。在 IE9 中,我无法按上传按钮。显示了,但是点击没有任何反应。因此不会打开文件选择对话框。在 Opera、chrome 和 FF 中,该按钮有效,当我单击时,会显示文件打开对话框。
Flash 在 IE9 中运行。 (版本 11,0,1,152)(youtube 正在运行)
当我右键单击按钮时,我没有收到 Flash 信息。当我在所有其他浏览器中执行此操作时,我会收到 Flash 信息。当我右键单击 youtube(在 ie9 中)时,我也会得到 flash 信息....?
这是我的 uploadify jquery 代码:
$(document).ready(function() {
$('#fileInput').uploadify({
'swf': '/Content/Scripts/uploadify3/uploadify.swf',
'uploader': '/nl-nl/Attachment/Upload',
'cancelImage': '/Content/Scripts/uploadify3/uploadify-cancel.png',
'checkExisting': '/nl-nl/Attachment/Check',
'multi': true,
'buttonText': 'Upload',
'postData' :{'RelationId' : '@cookie'},
'sizeLimit': 2147483647,
'auto': true,
onError: function(a, b, c, d) {
if (d.status == 404)
alert("Could not find upload script. Use a path relative to: " + "<?= getcwd() ?>");
else if (d.type === "HTTP")
alert("error " + d.type + ": " + d.status);
else if (d.type === "File Size")
alert(c.name + " " + d.type + " Limit: " + Math.round(d.sizeLimit / 1024) + "KB");
else
alert("error " + d.type + ": " + d.text);
},
onUploadComplete: function() {
$("#Grid").data('tGrid').ajaxRequest();
}
});
});
我是不是搞错了?这是闪存错误吗?还是别的什么?
最佳答案
当您将下载的 swf 替换为整个路径时,它会起作用
http://www.uploadify.com/uploadify/uploadify.swf
这不是优雅的解决方案,但它有效。 我仅在本地主机中遇到此问题。
现在选择按钮在 IE 中工作正常,但我们遇到了安全错误。 要解决这个问题,您需要在根目录中添加 crossdomain.xml 文件。
所有域的 crossdomain.xml 示例(仅用于测试)
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<site-control permitted-cross-domain-policies="all"/>
<allow-access-from domain="*" />
<allow-http-request-headers-from domain="*" headers="*"/>
</cross-domain-policy>
或尝试在 Global.asax 文件中添加行 在 RegisterRoutes 方法中添加此行
routes.IgnoreRoute("crossdomain.xml");
关于jquery - uploadify 3 选择文件在 ie9 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8031525/