jqueryasp.netjquery-file-uploadwebusercontrol

In a Blueimp jQuery file upload, setting dropzone to a div not working


I am trying to create a user control with this but having a problem while setting a Div as drop zone. As per api I should set jQuery object of target div and add preventDefault() method to avoid making whole document as drop area and make a selected area as drop zone.

Below code I am using to make it work

 function OnDocumentLoad(dropZoneElementId) {
        Initialize(dropZoneElementId);
          $(document).bind('drop dragover', function (e) {
            e.preventDefault();

       });

      }

function Initialize(dropZoneElementId) {
$('#genericFileUploader').fileupload({
    dataType: 'json',
    dropzone: dropZoneElementId,
    done: function (e, data) {
        $.each(data.result.files, function (index, file) {
            $('<p/>').text(file.name).appendTo(document.body);
        });
    },
    progressall: function (e, data) {
        var progress = parseInt(data.loaded / data.total * 100, 10);
        $('#progress .bar').css(
            'width',
            progress + '%'
        );
    }
});
} 

Solution

  • everything is fine except "dropzone", it should be dropZone.