filepicker.io

dynamic file picker.io control doesn't work


I Have Created Dynamic FilePicker Control on Button Click Event of Jquery but the button click event of this dynamic control does not open the filepicker.io popup where files get uploaded on filepicker...

Below is the html code by which i have created this control in jquery

<input type="filepicker" data-fp-apikey="Acdgfv0GWQXyMKwqVMfMHz" data-fp-mimetypes="image/*" data-fp-container="modal" data-fp-services="COMPUTER" class="uploadImg btn border-blue-btn" tabindex="31" style="display:none">                                <button type="button" class="uploadImg btn border-blue-btn">Pick File</button>


Solution

  • Filepicker javascript library construct widgets immediately after script is loaded. Using filepicker with any client side rendering library requires manually call

    filepicker.constructWidget();
    

    method on Dom element. You need to set element type as 'filepicker' etc.

    Basic example:

    var input = $('<input>').attr({
        type: 'filepicker',
        class:'picker',
    }).appendTo(config.results);
    
    filepicker.constructWidget(input);
    

    And full working example:

    http://jsfiddle.net/krystiangw/hfg6k8u2/