Demos:
In this example we limit our users with maximal 3 number of files, all files together must have maximal 3MB's and the file's extensions should be matched in the array(ex: ['jpg', 'png', 'gif']). We are also changig the file input to jQuery.filer default design. We also need to show the file preview in our browser before uploading the file.
$('#filer_input').filer({ limit: 3, maxSize: 3, extensions: ['jpg', 'jpeg', 'png', 'gif'], changeInput: true, showThumbs: true });
In this example we designed our own file input and used our own theme - 'dragdropbox'. We also added the file preview in our browser before uploading the file.
$('#filer_input').filer({ changeInput: '<div class="jFiler-input-dragDrop"><div class="jFiler-input-inner"><div class="jFiler-input-icon"><i class="icon-jfi-folder"></i></div><div class="jFiler-input-text"><h3>Click on this box</h3> <span style="display:inline-block; margin: 15px 0">or</span></div><a class="jFiler-input-choose-btn blue">Browse Files</a></div></div>', showThumbs: true, theme: "dragdropbox", templates: { box: '<ul class="jFiler-items-list jFiler-items-grid"></ul>', item: '<li class="jFiler-item">\ <div class="jFiler-item-container">\ <div class="jFiler-item-inner">\ <div class="jFiler-item-thumb">\ <div class="jFiler-item-status"></div>\ <div class="jFiler-item-info">\ <span class="jFiler-item-title"><b title="{{fi-name}}">{{fi-name | limitTo: 25}}</b></span>\ <span class="jFiler-item-others">{{fi-size2}}</span>\ </div>\ {{fi-image}}\ </div>\ <div class="jFiler-item-assets jFiler-row">\ <ul class="list-inline pull-left">\ <li>{{fi-progressBar}}</li>\ </ul>\ <ul class="list-inline pull-right">\ <li><a class="icon-jfi-trash jFiler-item-trash-action"></a></li>\ </ul>\ </div>\ </div>\ </div>\ </li>', itemAppend: '<li class="jFiler-item">\ <div class="jFiler-item-container">\ <div class="jFiler-item-inner">\ <div class="jFiler-item-thumb">\ <div class="jFiler-item-status"></div>\ <div class="jFiler-item-info">\ <span class="jFiler-item-title"><b title="{{fi-name}}">{{fi-name | limitTo: 25}}</b></span>\ <span class="jFiler-item-others">{{fi-size2}}</span>\ </div>\ {{fi-image}}\ </div>\ <div class="jFiler-item-assets jFiler-row">\ <ul class="list-inline pull-left">\ <li><span class="jFiler-item-others">{{fi-icon}}</span></li>\ </ul>\ <ul class="list-inline pull-right">\ <li><a class="icon-jfi-trash jFiler-item-trash-action"></a></li>\ </ul>\ </div>\ </div>\ </div>\ </li>', itemAppendToEnd: false, removeConfirmation: true, _selectors: { list: '.jFiler-items-list', item: '.jFiler-item', remove: '.jFiler-item-trash-action' } } });
If you want to have an input like in Example 1 and also to allow your users to upload files from different folders just set addMore option to true
addMore: true
In this example we activated Drag&Drop feature for the default jQuery.filer input. Note that this feature is working only with Instantly Upload feature!
$('#filer_input').filer({ changeInput: '<div class="jFiler-input-dragDrop"><div class="jFiler-input-inner"><div class="jFiler-input-icon"><i class="icon-jfi-cloud-up-o"></i></div><div class="jFiler-input-text"><h3>Drag&Drop files here</h3> <span style="display:inline-block; margin: 15px 0">or</span></div><a class="jFiler-input-choose-btn blue">Browse Files</a></div></div>', showThumbs: true, theme: "dragdropbox", templates: { box: '<ul class="jFiler-items-list jFiler-items-grid"></ul>', item: '<li class="jFiler-item">\ <div class="jFiler-item-container">\ <div class="jFiler-item-inner">\ <div class="jFiler-item-thumb">\ <div class="jFiler-item-status"></div>\ <div class="jFiler-item-info">\ <span class="jFiler-item-title"><b title="{{fi-name}}">{{fi-name | limitTo: 25}}</b></span>\ <span class="jFiler-item-others">{{fi-size2}}</span>\ </div>\ {{fi-image}}\ </div>\ <div class="jFiler-item-assets jFiler-row">\ <ul class="list-inline pull-left">\ <li>{{fi-progressBar}}</li>\ </ul>\ <ul class="list-inline pull-right">\ <li><a class="icon-jfi-trash jFiler-item-trash-action"></a></li>\ </ul>\ </div>\ </div>\ </div>\ </li>', itemAppend: '<li class="jFiler-item">\ <div class="jFiler-item-container">\ <div class="jFiler-item-inner">\ <div class="jFiler-item-thumb">\ <div class="jFiler-item-status"></div>\ <div class="jFiler-item-info">\ <span class="jFiler-item-title"><b title="{{fi-name}}">{{fi-name | limitTo: 25}}</b></span>\ <span class="jFiler-item-others">{{fi-size2}}</span>\ </div>\ {{fi-image}}\ </div>\ <div class="jFiler-item-assets jFiler-row">\ <ul class="list-inline pull-left">\ <li><span class="jFiler-item-others">{{fi-icon}}</span></li>\ </ul>\ <ul class="list-inline pull-right">\ <li><a class="icon-jfi-trash jFiler-item-trash-action"></a></li>\ </ul>\ </div>\ </div>\ </div>\ </li>', progressBar: '<div class="bar"></div>', itemAppendToEnd: false, removeConfirmation: true, _selectors: { list: '.jFiler-items-list', item: '.jFiler-item', progressBar: '.bar', remove: '.jFiler-item-trash-action' } }, dragDrop: { dragEnter: null, dragLeave: null, drop: null, }, uploadFile: { url: "./php/upload.php", data: null, type: 'POST', enctype: 'multipart/form-data', beforeSend: function(){}, success: function(data, el){ var parent = el.find(".jFiler-jProgressBar").parent(); el.find(".jFiler-jProgressBar").fadeOut("slow", function(){ $("<div class=\"jFiler-item-others text-success\"><i class=\"icon-jfi-check-circle\"></i> Success</div>").hide().appendTo(parent).fadeIn("slow"); }); }, error: function(el){ var parent = el.find(".jFiler-jProgressBar").parent(); el.find(".jFiler-jProgressBar").fadeOut("slow", function(){ $("<div class=\"jFiler-item-others text-error\"><i class=\"icon-jfi-minus-circle\"></i> Error</div>").hide().appendTo(parent).fadeIn("slow"); }); }, statusCode: null, onProgress: null, onComplete: null }, onRemove: function(itemEl, file){ var file = file.name; $.post('./php/remove_file.php', {file: file}); } });
In this example we activated Instantly Upload feature. After choosing a file, it should automatically upload it!
$('#filer_input').filer({ showThumbs: true, templates: { box: '<ul class="jFiler-items-list jFiler-items-grid"></ul>', item: '<li class="jFiler-item">\ <div class="jFiler-item-container">\ <div class="jFiler-item-inner">\ <div class="jFiler-item-thumb">\ <div class="jFiler-item-status"></div>\ <div class="jFiler-item-info">\ <span class="jFiler-item-title"><b title="{{fi-name}}">{{fi-name | limitTo: 25}}</b></span>\ <span class="jFiler-item-others">{{fi-size2}}</span>\ </div>\ {{fi-image}}\ </div>\ <div class="jFiler-item-assets jFiler-row">\ <ul class="list-inline pull-left">\ <li>{{fi-progressBar}}</li>\ </ul>\ <ul class="list-inline pull-right">\ <li><a class="icon-jfi-trash jFiler-item-trash-action"></a></li>\ </ul>\ </div>\ </div>\ </div>\ </li>', itemAppend: '<li class="jFiler-item">\ <div class="jFiler-item-container">\ <div class="jFiler-item-inner">\ <div class="jFiler-item-thumb">\ <div class="jFiler-item-status"></div>\ <div class="jFiler-item-info">\ <span class="jFiler-item-title"><b title="{{fi-name}}">{{fi-name | limitTo: 25}}</b></span>\ <span class="jFiler-item-others">{{fi-size2}}</span>\ </div>\ {{fi-image}}\ </div>\ <div class="jFiler-item-assets jFiler-row">\ <ul class="list-inline pull-left">\ <li><span class="jFiler-item-others">{{fi-icon}}</span></li>\ </ul>\ <ul class="list-inline pull-right">\ <li><a class="icon-jfi-trash jFiler-item-trash-action"></a></li>\ </ul>\ </div>\ </div>\ </div>\ </li>', progressBar: '<div class="bar"></div>', itemAppendToEnd: false, removeConfirmation: true, _selectors: { list: '.jFiler-items-list', item: '.jFiler-item', progressBar: '.bar', remove: '.jFiler-item-trash-action' } }, uploadFile: { url: "./php/upload.php", data: null, type: 'POST', enctype: 'multipart/form-data', beforeSend: function(){}, success: function(data, el){ var parent = el.find(".jFiler-jProgressBar").parent(); el.find(".jFiler-jProgressBar").fadeOut("slow", function(){ $("<div class=\"jFiler-item-others text-success\"><i class=\"icon-jfi-check-circle\"></i> Success</div>").hide().appendTo(parent).fadeIn("slow"); }); }, error: function(el){ var parent = el.find(".jFiler-jProgressBar").parent(); el.find(".jFiler-jProgressBar").fadeOut("slow", function(){ $("<div class=\"jFiler-item-others text-error\"><i class=\"icon-jfi-minus-circle\"></i> Error</div>").hide().appendTo(parent).fadeIn("slow"); }); }, statusCode: null, onProgress: null, onComplete: null }, onRemove: function(itemEl, file){ var file = file.name; $.post('./php/remove_file.php', {file: file}); } });
In this example we activated addMore option and added 2 files(this files were already uploaded). Now you can edit the 2 uploaded files or add some more.
$('#filer_input').filer({ showThumbs: true, addMore: true, files: [ { name: "appended_file.jpg", size: 5453, type: "image/jpg", file: "http://dummyimage.com/720x480/f9f9f9/191a1a.jpg" }, { name: "appended_file_2.jpg", size: 9453, type: "image/jpg", file: "http://dummyimage.com/640x480/f9f9f9/191a1a.jpg" } ], templates: { box: '<ul class="jFiler-items-list jFiler-items-grid"></ul>', item: '<li class="jFiler-item">\ <div class="jFiler-item-container">\ <div class="jFiler-item-inner">\ <div class="jFiler-item-thumb">\ <div class="jFiler-item-status"></div>\ <div class="jFiler-item-info">\ <span class="jFiler-item-title"><b title="{{fi-name}}">{{fi-name | limitTo: 25}}</b></span>\ <span class="jFiler-item-others">{{fi-size2}}</span>\ </div>\ {{fi-image}}\ </div>\ <div class="jFiler-item-assets jFiler-row">\ <ul class="list-inline pull-left">\ <li>{{fi-progressBar}}</li>\ </ul>\ <ul class="list-inline pull-right">\ <li><a class="icon-jfi-trash jFiler-item-trash-action"></a></li>\ </ul>\ </div>\ </div>\ </div>\ </li>', itemAppend: '<li class="jFiler-item">\ <div class="jFiler-item-container">\ <div class="jFiler-item-inner">\ <div class="jFiler-item-thumb">\ <div class="jFiler-item-status"></div>\ <div class="jFiler-item-info">\ <span class="jFiler-item-title"><b title="{{fi-name}}">{{fi-name | limitTo: 25}}</b></span>\ <span class="jFiler-item-others">{{fi-size2}}</span>\ </div>\ {{fi-image}}\ </div>\ <div class="jFiler-item-assets jFiler-row">\ <ul class="list-inline pull-left">\ <li><span class="jFiler-item-others">{{fi-icon}}</span></li>\ </ul>\ <ul class="list-inline pull-right">\ <li><a class="icon-jfi-trash jFiler-item-trash-action"></a></li>\ </ul>\ </div>\ </div>\ </div>\ </li>', itemAppendToEnd: false, removeConfirmation: true, _selectors: { list: '.jFiler-items-list', item: '.jFiler-item', remove: '.jFiler-item-trash-action' } } });