Manually trigger 'open file dialog' using plupload

前端 未结 6 1809
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-15 08:51

I\'m using plupload to client scaling of pictures before they are uploaded. I like the feature that it gracefully falls back to html4 if the user doesn\'t have flash, silver

6条回答
  •  自闭症患者
    2020-12-15 09:24

    @Per Hornshøj-Schierbeck After uploader has been init. It take few time to render input file to select. So you need to wait like below:

    this.uploader.init();
    var task = new Ext.util.DelayedTask(function () {
        var inputArray = $('div.moxie-shim input[type=file]');
        var input = inputArray.length > 1 ? inputArray[inputArray.length - 1] : 
                    inputArray[0];
        $(input).trigger('click');
     });
    
    task.delay(100);
    

    The code in javascript is similar. Worked for me with plupload 2.3.6

    Hop this help!

提交回复
热议问题