【发布时间】:2015-07-10 00:45:22
【问题描述】:
Plupload 可在所有浏览器栏 IE 中运行。在 IE 中按下 #photo-upload 链接后,文件浏览器无法打开。 uploader 的实例肯定是正确创建的 - 使用开发工具检查。
非常感谢任何解决方案!
这是我们用来创建上传器的脚本:
var uploader = new plupload.Uploader({
runtimes : 'gears,html5,flash,silverlight,html4',
browse_button : 'photo-upload',
container : 'img-container',
url : 'productPhoto.php?id=<?=$_GET["id"];?>',
max_file_size : '5mb',
flash_swf_url : '/dev/plupload/js/plupload.flash.swf',
silverlight_xap_url : '/dev/plupload/js/plupload.silverlight.xap',
unique_names : true,
filters : [{title : "Image files", extensions : "jpg,gif,png"}],
multipart_params: {type:1},
// Post init events, bound after the internal events
init : {
UploadProgress: function(up, file) {
// Called while a file is being uploaded
$("#bar").css("width",file.percent+"%");
},
FilesAdded: function(up, files) {
$(".progress").slideDown();
uploader.start();
up.refresh(); // Reposition Flash/Silverlight
},
UploadComplete: function(up, file, info) {
// Called when a file has finished uploading
setTimeout(function(){
$(".progress").slideUp();
$("#bar").css("width","0");
document.location.reload();
},2000);
},
Error: function(up, args) {
// Called when a error has occured
alert(args);
up.refresh(); // Reposition Flash/Silverlight
}
}
});
uploader.init();
【问题讨论】:
-
是否出现任何错误?你的代码看起来不错。
#photo-uploadhtml和绑定方法在哪里? -
没有报错,好像纯粹是Plupload的
browse_button的绑定。 -
此代码是位于按钮的 html 声明上方还是下方?此代码是否在 $(document).ready 上执行?
-
在页面底部。代码初始化良好(Flash 运行时已正确创建)