tôi có chức năng javascript đơn giản bên trong cơ thể $(function() { ... });
flash runtime không hoạt động trong IE8 sử dụng PLupload
var uploader = new plupload.Uploader({
runtimes: 'html5,flash,silverlight',
browse_button: 'pickfiles',
container: 'uploader',
max_file_size: '20mb',
unique_names: true,
multiple_queues: false,
//drop_element: 'dropzone',
url: '/Home/Upload',
flash_swf_url: '../../../Scripts/upload/plupload.flash.swf',
silverlight_xap_url: '../../../Scripts/upload/plupload.silverlight.xap',
filters: [
{ title: "Image files", extensions: "jpg,gif,png" },
{ title: "Zip files", extensions: "zip" }
],
chunk_size: '2mb',
resize: { width: 320, height: 240, quality: 90 }
});
uploader.bind("Init", function (up, params) {
$("#runtime").html("<div>Current runtime: " + params.runtime + "</div>");
});
$("#uploadfiles").bind("click", function (e) {
uploader.start();
e.preventDefault();
});
uploader.init();
uploader.bind("FilesAdded", function (up, files) {
$.each(files, function (i, file) {
$('#runtime').append(
'<div id="' + file.id + '">' +
file.name + ' (' + plupload.formatSize(file.size) + ') <b></b>' +
'</div>');
});
up.refresh();
});
uploader.bind("UploaderProgress", function (up, file) {
$("#" + file.id + " b").html(file.percent + "%");
});
uploader.bind("Error", function (up, file) {
$('#runtime').append("<div>Error: " + err.code +
", Message: " + err.message +
(err.file ? ", File: " + err.file.name : "") +
"</div>");
up.refresh();
});
uploader.bind("FileUploaded", function (up, file) {
$("#" + file.id + " b").html("100%");
});
và HTML
<div class="container">
<div>Logo: </div>
<div style="clear"></div>
<div id="uploader">
<div id="runtime" class="right">
No runtime was found !
</div>
<div>
<a id="pickfiles" href="#">[Select files]</a>
<a id="uploadfiles" href="#">[Upload files]</a>
</div>
</div>
</div>
Các lỗi được hiển thị trong hình sau:
http://i.imgur.com/5t0sT.jpg (để xem kích thước đầy đủ)
Tôi thấy có vấn đề với bộ lọc tệp. Tôi chạy các ví dụ PLUpload.com trên IE8 và nó hoạt động tốt với thời gian chạy Flash.
Trên các trình duyệt khác, trình tải lên của tôi hoạt động hoàn hảo. Ngoài ra, tôi đã cài đặt phiên bản Flash mới nhất cho TẤT CẢ các trình duyệt (IE8, FF9, Chrome 16) nhưng sự cố vẫn tồn tại trong IE8.
ISSUE FIXED: không chèn đối tượng tải lên vào div có thuộc tính visibility:hidden
hoặc display:none
.
Bạn có thể mô tả giải pháp tốt hơn không? Viết một câu trả lời để mọi người thấy rằng một giải pháp đã được tìm thấy? Tôi gặp lỗi tương tự, nhưng điều này không hiệu quả với tôi. – oma