$(document).ready(function(){
//Example 2
$("#filer_input2").filer({
limit: null,
maxSize: null,
extensions: null,
changeInput: '
',
showThumbs: true,
theme: "dragdropbox",
templates: {
box: '',
item: '\
\
',
itemAppend: '\
\
',
progressBar: '',
itemAppendToEnd: true,
canvasImage: true,
removeConfirmation: true,
_selectors: {
list: '.jFiler-items-list',
item: '.jFiler-item',
progressBar: '.bar',
remove: '.jFiler-item-trash-action'
}
},
dragDrop: {
dragEnter: null,
dragLeave: null,
drop: null,
dragContainer: null,
},
uploadFile: {
url: "./php1/ajax_upload_file.php",
data: null,
type: 'POST',
enctype: 'multipart/form-data',
synchron: true,
beforeSend: function(){},
success: function(data, itemEl, listEl, boxEl, newInputEl, inputEl, id){
var parent = itemEl.find(".jFiler-jProgressBar").parent(),
new_file_name = JSON.parse(data),
filerKit = inputEl.prop("jFiler");
filerKit.files_list[id].name = new_file_name;
itemEl.find(".jFiler-jProgressBar").fadeOut("slow", function(){
$(" Uploaded
").hide().appendTo(parent).fadeIn("slow");
});
},
error: function(el){
var parent = el.find(".jFiler-jProgressBar").parent();
el.find(".jFiler-jProgressBar").fadeOut("slow", function(){
$(" Error
").hide().appendTo(parent).fadeIn("slow");
});
},
statusCode: null,
onProgress: null,
onComplete: null
},
files: null,
addMore: false,
allowDuplicates: true,
clipBoardPaste: true,
excludeName: null,
beforeRender: null,
afterRender: null,
beforeShow: null,
beforeSelect: null,
onSelect: null,
afterShow: null,
onRemove: function(itemEl, file, id, listEl, boxEl, newInputEl, inputEl){
var filerKit = inputEl.prop("jFiler"),
file_name = filerKit.files_list[id].name;
$.post('./php1/ajax_remove_file.php', {file: file_name});
},
onEmpty: null,
options: null,
dialogs: {
alert: function(text) {
return alert(text);
},
confirm: function (text, callback) {
confirm(text) ? callback() : null;
}
},
captions: {
button: "Choose Files",
feedback: "Choose files To Upload",
feedback2: "files were chosen",
drop: "Drop file here to Upload",
removeConfirmation: "Are you sure you want to remove this file?",
errors: {
filesLimit: "Only {{fi-limit}} files are allowed to be uploaded.",
filesType: "Only Images are allowed to be uploaded.",
filesSize: "{{fi-name}} is too large! Please upload file up to {{fi-maxSize}} MB.",
filesSizeAll: "Files you've choosed are too large! Please upload files up to {{fi-maxSize}} MB."
}
}
});
})