Plupload 文件浏览器打不开
我正在尝试将 plupload 与 mvc2 一起使用,但 filebrowser-window 未打开。
我的代码:
<script type="text/javascript">
// Convert divs to queue widgets when the DOM is ready
$(function () {
$("#uploader").pluploadQueue({
// General settings
runtimes: 'gears,flash,silverlight,browserplus,html5',
url: '<%: Url.Content( "~//Uploades/Horses/" ) %>',
max_file_size: '10mb',
chunk_size: '1mb',
unique_names: true,
// Resize images on clientside if we can
resize: { width: 320, height: 240, quality: 90 },
// Specify what files to browse for
filters: [
{ title: "Image files", extensions: "jpg,gif,png" },
{ title: "Zip files", extensions: "zip" }
],
// Flash settings
flash_swf_url: '../../../../Scripts/plupload/plupload.flash.swf',
// Silverlight settings
silverlight_xap_url: '../../../../Scripts/plupload/plupload.silverlight.xap'
});
// Client side form validation
$('form').submit(function (e) {
var uploader = $('#uploader').pluploadQueue();
uploader.refresh();
// Validate number of uploaded files
if (uploader.total.uploaded == 0) {
// Files in queue upload them first
if (uploader.files.length > 0) {
// When all files are uploaded submit form
uploader.bind('UploadProgress', function () {
if (uploader.total.uploaded == uploader.files.length)
$('form').submit();
});
uploader.start();
} else
alert('You must at least upload one file.');
e.preventDefault();
}
});
});
<div id="uploader" style="height:300px">
<p>You browser doesn't have Flash, Silverlight, Gears, BrowserPlus or HTML5 support.</p>
</div>
如果我尝试调试 uploadingelemt,则显示没有任何问题。但是,如果我单击“添加文件”,窗口只会跳转到页面顶部,并且不会发生其他情况。
Firebug 没有显示任何问题。
我在《FF4》和《FF4》中都尝试过。使用 flash 和 silverlight 的 IE 8
有人有想法吗? 非常感谢您并祝您周末愉快!
I'm trying to use plupload with mvc2 but the filebrowser-window does not open.
my code:
<script type="text/javascript">
// Convert divs to queue widgets when the DOM is ready
$(function () {
$("#uploader").pluploadQueue({
// General settings
runtimes: 'gears,flash,silverlight,browserplus,html5',
url: '<%: Url.Content( "~//Uploades/Horses/" ) %>',
max_file_size: '10mb',
chunk_size: '1mb',
unique_names: true,
// Resize images on clientside if we can
resize: { width: 320, height: 240, quality: 90 },
// Specify what files to browse for
filters: [
{ title: "Image files", extensions: "jpg,gif,png" },
{ title: "Zip files", extensions: "zip" }
],
// Flash settings
flash_swf_url: '../../../../Scripts/plupload/plupload.flash.swf',
// Silverlight settings
silverlight_xap_url: '../../../../Scripts/plupload/plupload.silverlight.xap'
});
// Client side form validation
$('form').submit(function (e) {
var uploader = $('#uploader').pluploadQueue();
uploader.refresh();
// Validate number of uploaded files
if (uploader.total.uploaded == 0) {
// Files in queue upload them first
if (uploader.files.length > 0) {
// When all files are uploaded submit form
uploader.bind('UploadProgress', function () {
if (uploader.total.uploaded == uploader.files.length)
$('form').submit();
});
uploader.start();
} else
alert('You must at least upload one file.');
e.preventDefault();
}
});
});
<div id="uploader" style="height:300px">
<p>You browser doesn't have Flash, Silverlight, Gears, BrowserPlus or HTML5 support.</p>
</div>
If I try to debug the uploadingelemt is showen with out any problems. But If I click add files the window just jumps to the top of my page and nothin else happens.
Firebug does not show any problems.
I've tried in FF4 & IE 8 using flash and silverlight
Any one an idea?
Thank you very much and wish you a nice weekend!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的浏览器将使用 Flash 运行时,因为它列在“html5”之前。 Flash 运行时需要设置“容器:“my_uploader_container_id””
并且您的“pickfiles”按钮需要放置到 ID 为“my_uploader_container_id”的 DIV 中。
另一个解决方案是使用 html5 引擎 - 在“运行时”参数中将其列在 flash 之前。但 html5 运行时在 IE 中不起作用。
Your browser will use Flash runtime as it is listed before the 'html5'. Flash runtime requires setting of 'container: "my_uploader_container_id"'
And your 'pickfiles' button need to be placed into the DIV with ID 'my_uploader_container_id'.
Another solution is using html5 engine - list it before flash in 'runtimes' parameter. But html5 runtime does not work in IE.