javascript - Dropzone.js - Setting Basic Parameters -
i trying implement dropzone.js
custom cms. have no problems processing files needed in php, that's easy part.
i need know how following on page-by-page basis (will use dropzone script in several pages different functions):
- restrict files types (jpg,jpeg,pdf)
- restrict number of files can uploaded (some pages 1 file, 100)
- restrict max file size
- redirect page or have 'next' button/link appear when file upload complete.
can add @ bottom of page, while addressing settings:
<script src="../assets/global/plugins/dropzone/dropzone.js"></script> <script> jquery(document).ready(function() { // initiate layout , plugins metronic.init(); // init metronic core components layout.init(); // init current layout demo.init(); // init demo features formdropzone.init(); }); </script>
html:
<div id="my-dropzone"></div>
javascript:
var initdropzone = function( filesallowed ){ dropzone.options.mydropzone = { paramname: "file", uploadmultiple: true, maxfiles: filesallowed, //this need set upon init, acceptedfiles: ['image/jpeg', 'image/jpg', 'application/pdf'], complete: function() { alert('your file uploaded!'); } }; } //init dropzone initdropzone( 4 );
Comments
Post a Comment