我对 plupload 的工作有一个问题,即:我在一个页面上嵌入了带有 MoxieMannager 插件的 tinyMCE,并且我在同一页面上有了 Plupload(用于上传文件)。
所以 Plupload 可以工作,但是如果您激活 Moxiemanager(在页面上),那么一切都会立即停止工作吗?如何绕过这个限制?
代码示例:
<script type="text/javascript" src="./plupload/plupload.full.min.js"></script>
<script src="tinymce/tinymce.min.js"></script>
<script>tinymce.init({
selector:'<?php print $MCE3; ?>',
toolbar: "<?php print $MCE2; ?>",
language: 'ru',
plugins: '<?php print $MCE; ?>',
relative_urls : true,
document_base_url : "<?php print $url; ?>"
});</script>
<a data-action='uploadFile' class="ipsButton ipsButton_small ipsButton_primary ipsPos_left" id="pickfiles" href="javascript:;">Выбрать файл...1</a>
<a data-action='uploadFile' class="ipsButton ipsButton_small ipsButton_primary ipsPos_left" id="uploadfiles" href="javascript:;">Загрузить на сервер</a>
<ul id="filelist"></ul>
<pre id="console"></pre>
<script type="text/javascript">
// Custom example logic
var uploader3 = new plupload.Uploader({
runtimes : 'html5,flash,silverlight,html4',
browse_button : 'pickfiles', // you can pass in id...
container: document.getElementById('container'),
url : "./plupload/examples/q1.php?pgid=<?php print $pgid; ?>",
filters : {
pgid: <?php print $pgid; ?>,
max_file_size : '10mb',
mime_types: [
{title : "Image files", extensions : "jpg,gif,png"},
{title : "Zip files", extensions : "zip"}
]
},
// Flash settings
flash_swf_url : '/plupload/Moxie.swf',
// Silverlight settings
silverlight_xap_url : '/plupload/Moxie.xap',
init: {
PostInit: function() {
document.getElementById('filelist').innerHTML = '';
document.getElementById('uploadfiles').onclick = function() {
uploader3.start();
return false;
};
},
FilesAdded: function(up, files) {
plupload.each(files, function(file) {
document.getElementById('filelist').innerHTML += '<div id="' + file.id + '">' + file.name + ' (' + plupload.formatSize(file.size) + ') <b></b></div>';
});
},
UploadProgress: function(up, file) {
document.getElementById(file.id).getElementsByTagName('b')[0].innerHTML = '<span>' + file.percent + "%</span>";
},
Error: function(up, err) {
document.getElementById('console').innerHTML += "\nError #" + err.code + ": " + err.message;
}
}
});
uploader3.init();
</script>
请帮忙解决问题