Plupload - 添加在IE8中不起作用的文件

时间:2014-04-21 14:29:45

标签: javascript jquery internet-explorer-8 plupload html4

我无法获取plupload添加文件以打开IE8中的文件选择对话框。它在Firefox中运行良好。

我尝试了一些我遇到过的不同想法:

  1. 更改Z-index
  2. Flash和Html4作为运行时
  3. 手动触发按钮
  4. 刷新上传者
  5. 确保我的容器div没有隐藏
  6. 这是我的代码:

    var uploader = new plupload.Uploader({
            runtimes: 'html5,html4',
            multipart: true,
            source: 'AccountDocument',
            browse_button: 'pickfiles',
    
            container: 'container', // ... or DOM Element itself
            url: "Home/UploadAttachment",
    
            filters: {
                max_file_size: '10mb',
            },
    
            flash_swf_url: 'http://rawgithub.com/moxiecode/moxie/master/bin/flash/Moxie.cdn.swf',
            silverlight_xap_url: 'http://rawgithub.com/moxiecode/moxie/master/bin/silverlight/Moxie.cdn.xap',
    
            preinit: attachCallbacks,
    
    
            init: {
                PostInit: function () {
    
                    $('#filelist').innerHTML = '';
    
                    $('#uploadfiles').onclick = function () {
                        $('#uploadfiles').text('Uploading...');
    
                       submit(false, 'AccountDocument', 'frmAccountDocument' + r, BusinessUnitID);
                        setTimeout(function () {
                            uploader.settings.multipart_params = { accountDocumentID: $("#ID").val(), description: $("#AttachmentDescription").val() };
                            uploader.start();
                            $('#uploadfiles').text('UPLOAD');
    
                       }, 500); 
                        return false;
                    };
                },
    
    
                Browse: function (up) {
                    alert('hi');
                    // Called when file picker is clicked
                    log('[Browse]');
                },
    
                FilesAdded: function (up, files) {
                    $('#tblAttachmentDisplay').show();
                    $('#uploadfile').show();
                    $('#pickfiles').hide();
    
    
                    plupload.each(files, function (file) {
                        $('#tblAttachmentDisplay #trUploadRow').show();
                        $('#tblAttachmentDisplay #trUploadRow #tdUploadFileName').text(file.name);
                        $('#tblAttachmentDisplay #trUploadRow #tdUploadDescription').html('<input type="text" class="text-box" value ="Please enter a description" id="AttachmentDescription" />');
                        $("#tblAttachmentDisplay #trUploadRow #tdUploadDescription #AttachmentDescription").focus().select();
    
                    });
                },
    
                Error: function (up, err) {
                    $('#console').innerHTML += "\nError #" + err.code + ": " + err.message;
                }
            }
        });
    
    
    
    
        uploader.bind("Init", function (up, params) {
            $("#runtime").html("<div>Current runtime: " + params.runtime + "</div>");
        });
    
        uploader.init();
    
        uploader.refresh();
    
    <table id="tblAttachment">
    
        <tr>
            <td></td>
            <td>
                <div id="filelist"></div>
                <a id="pickfiles" href="#" class="lnkHotLightBlue txtBoldSubHeader" style="color:#5191CD;display:block;position: relative; z-index: 999999">Upload a File</a>
                <div id="container"></div>
            </td>
        </tr>
    
    </table>
    
    
    
    <div id="filelist">Your browser doesn't have Flash, Silverlight or HTML5 support.</div>
    <div id="runtime">
                            No runtime was found !
    </div>
    

0 个答案:

没有答案