plupload 不会重定向到 url
plupload doesn't redirect to url
我正在使用 plupload 将图像文件上传到服务器。
javascript 代码直接取自 plupload 网站的示例页面:
<div id="filelist">Your browser doesn't have Flash, Silverlight or HTML5 support.</div>
<button id="pickfiles" href="javascript:;" />Dosya Seç<br /><br />
<button id="uploadfiles" href="javascript:;" />YÜKLE<br /><br />
<pre id="console"></pre>
<script type="text/javascript">
// Custom example logic
var uploader = new plupload.Uploader({
runtimes : 'html5,flash,silverlight,html4',
browse_button : 'pickfiles', // you can pass in id...
container: document.getElementById('container'), // ... or DOM Element itself
url : 'yonetim.asp?id=13&sid=1&emlak=<%=emlakid%>',
resize : {width : 400, height : 300, quality : 99},
filters : {
max_file_size : '15mb',
mime_types: [
{title : "Image files", extensions : "jpg,gif,png"}
]
},
init: {
PostInit: function() {
document.getElementById('filelist').innerHTML = '';
document.getElementById('uploadfiles').onclick = function() {
uploader.start();
return false;
};
},
FilesAdded: function(up, files) {
plupload.each(files, function(file) {
document.getElementById('filelist').innerHTML += '<br><br><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>";
},
UploadComplete: function (up, files) {
// Called when all files are either uploaded or failed
console.log('[UploadComplete]');
window.location = 'yonetim.asp?id=13&sid=1&emlak=<%=emlakid%>';
},
Error: function(up, err) {
document.getElementById('console').innerHTML += "\nError #" + err.code + ": " + err.message;
}
}
});
uploader.init();
</script>
脚本似乎可以工作;当我单击开始上传按钮并指示百分比时,它会加载图像文件。但最后它没有重定向到上传页面即 "yonetim.asp",实际上它停留在同一页面并给出 200 http 错误。
任何想法都会有所帮助。
文档说上传完成事件是UploadComplete。你没有绑定那个事件。
UploadComplete: function(up, files) {
// Called when all files are either uploaded or failed
console.log('[UploadComplete]');
window.location = 'yonetim.asp';
},
我正在使用 plupload 将图像文件上传到服务器。 javascript 代码直接取自 plupload 网站的示例页面:
<div id="filelist">Your browser doesn't have Flash, Silverlight or HTML5 support.</div>
<button id="pickfiles" href="javascript:;" />Dosya Seç<br /><br />
<button id="uploadfiles" href="javascript:;" />YÜKLE<br /><br />
<pre id="console"></pre>
<script type="text/javascript">
// Custom example logic
var uploader = new plupload.Uploader({
runtimes : 'html5,flash,silverlight,html4',
browse_button : 'pickfiles', // you can pass in id...
container: document.getElementById('container'), // ... or DOM Element itself
url : 'yonetim.asp?id=13&sid=1&emlak=<%=emlakid%>',
resize : {width : 400, height : 300, quality : 99},
filters : {
max_file_size : '15mb',
mime_types: [
{title : "Image files", extensions : "jpg,gif,png"}
]
},
init: {
PostInit: function() {
document.getElementById('filelist').innerHTML = '';
document.getElementById('uploadfiles').onclick = function() {
uploader.start();
return false;
};
},
FilesAdded: function(up, files) {
plupload.each(files, function(file) {
document.getElementById('filelist').innerHTML += '<br><br><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>";
},
UploadComplete: function (up, files) {
// Called when all files are either uploaded or failed
console.log('[UploadComplete]');
window.location = 'yonetim.asp?id=13&sid=1&emlak=<%=emlakid%>';
},
Error: function(up, err) {
document.getElementById('console').innerHTML += "\nError #" + err.code + ": " + err.message;
}
}
});
uploader.init();
</script>
脚本似乎可以工作;当我单击开始上传按钮并指示百分比时,它会加载图像文件。但最后它没有重定向到上传页面即 "yonetim.asp",实际上它停留在同一页面并给出 200 http 错误。 任何想法都会有所帮助。
文档说上传完成事件是UploadComplete。你没有绑定那个事件。
UploadComplete: function(up, files) {
// Called when all files are either uploaded or failed
console.log('[UploadComplete]');
window.location = 'yonetim.asp';
},