plupload does not seem to be uploading files in IE 9. It works in other browsers

烂漫一生 提交于 2019-12-05 09:16:22
Anant Dabhi

For everyone who has the same problem as me:

I had the following HTML code:

<div class="container" style="display:none">
    <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>

The class container was created as dialog:

$(function(){
    $(".container").dialog({modal:true, width:400});
});

As we know that the div is initially hidden because of display: none (of course, you can set up autoOpen:false as a new option in the dialog object), we can remove the style.

In IE8 (probably in earlier and later version) the uploader cannot be instantiated properly if the div is hidden. (Returns the above error)

In Chrome and Firefox (I did't test this issue in Opera), it works fine.

So, my advice is to avoid hidden blocks (even if you wish to create a modal dialog).

I removed the display:none style and dialog object from that div and now it works very good in IE8.

Why? I don't know why in IE, the instance of object is not created at the start-up of the page, though in Firefox and Chrome, the instance was created normally.

For max compatibility you should rearrange the plugins priority list.

 var uploader = new plupload.Uploader({
        runtimes : 'gears,html5,html4,flash,silverlight,browserplus',

REPLACE THAT WITH

 var uploader = new plupload.Uploader({
        runtimes : 'flash,html5,silverlight,browserplus,gears,html4',

Make sure the flash file exist and the path is relative to the location of your js file.

flash_swf_url : 'assets/js/vendor/plupload/plupload.flash.swf',

I am working with this jquery.

You can try this out as I am working with this in ie7+ and all browser fro my file uploads.

Here is the file code I am newbie on how to upload js file at here.

<form id="uploadForm" method="post" enctype="multipart/form-data" action="javascript:void(0);" autocomplete="off">
                            <div class="vasplusfile_adds">
                                <label>Upload More</label>
                                <input type="hidden" name="myfile"  />
                                <div class="input customfile-container">
                                    <input type="file" name="uploadfile" id="file" />
                                </div>
                                <div class="clear"></div>
                                <br>
                                <div class="input" id="status" align="left" > </div>
                            </div>
                        </form>


<script>
  $(function() {
     $('#upload_file').live('change',function() { 
    $("#status").html('<div id="upload_now" class="btn">Click to Upload</div>');});
    $('#upload_now').live('click', function() { 
       $("#uploadForm").vPB({ beforeSubmit: function() { 
           $("#status").html('<div style="" align="center">Loading</div>');
            url: '',
            success: function(response) { // my response after file uploaded 
         }}).submit(); }); }); 
</script>

Example can be found from my fiddle.

Have a happy coding :)

live demo use working in ie7 http://vasplus.info/demos/upload_without_page_refresh/index.php

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!