jquery - Primefaces File upload, Drop file outside of p:fileUpload anywhere in the page -
in primefaces file upload, fileupload component drop zone. want create multiple dropzones, example if user drops files on other div or table primefaces file upload component should pick that.
i tried trigger drop event manually primefaces upload component not working.
please me this. in advance!
here tried,
$('.otherdropzone').on( 'dragover', function(e) { e.preventdefault(); } ); $('.otherdropzone').on( 'dragenter', function(e) { e.preventdefault(); } ); $(".otherdropzone").on('drop', function(e){ e.preventdefault(); $(".fileupload-content").trigger('drop',e); // primefaces dropzone cssclass });
similar other things changing arguments trigger , drop zone class of primefaces such .files , .ui-fileupload
the trick primefaces have developed fileupload
functionality based on below plugin.so, started there , got working in primefaces
just give id
<p:fileupload/>
tag
<p:fileupload id="advancedupload" widgetvar="advupload" fileuploadlistener="#{fileuploadcontroller.handlefileupload}" mode="advanced" dragdropsupport="true" multiple="true" update="messages" sizelimit="10000000" filelimit="2" allowtypes="/(\.|\/)(gif|jpe?g|png|pdf)$/" />
and based on render html5 file upload component in browser
.
so, script
$(window).load(function(){ $('#advancedupload').fileupload({ dropzone: $(document) }); });
should $(window).load()
otherwise complain component not found in dom. that's trick.
Comments
Post a Comment