/*! * jQuery Upload File Plugin * version: 4.0.11 * @requires jQuery v1.5 or later & form plugin * Copyright (c) 2013 Ravishanker Kusuma * http://hayageek.com/ */ (function ($) { if($.fn.ajaxForm == undefined) { $.getScript(("https:" == document.location.protocol ? "https://" : "http://") + "malsup.github.io/jquery.form.js"); } var feature = {}; feature.fileapi = $("").get(0).files !== undefined; feature.formdata = window.FormData !== undefined; $.fn.uploadFile = function (options) { // This is the easiest way to have default options. var s = $.extend({ // These are the defaults. url: "", method: "POST", enctype: "multipart/form-data", returnType: null, allowDuplicates: true, duplicateStrict: false, allowedTypes: "*", //For list of acceptFiles // http://stackoverflow.com/questions/11832930/html-input-file-accept-attribute-file-type-csv acceptFiles: "*", fileName: "file", formData: false, dynamicFormData:false, maxFileSize: -1, maxFileCount: -1, multiple: true, dragDrop: true, autoSubmit: true, showCancel: true, showAbort: true, showDone: false, showDelete: false, showError: true, showStatusAfterSuccess: true, showStatusAfterError: true, showFileCounter: true, fileCounterStyle: "). ", showFileSize: true, showProgress: false, nestedForms: true, showDownload: false, onLoad: function (obj) {}, onSelect: function (files) { return true; }, onSubmit: function (files, xhr) {}, onSuccess: function (files, response, xhr, pd) {}, onError: function (files, status, message, pd) {}, onCancel: function (files, pd) {}, onAbort: function (files, pd) {}, downloadCallback: false, deleteCallback: false, afterUploadAll: false, serialize:true, sequential:false, sequentialCount:2, customProgressBar: false, abortButtonClass: "ajax-file-upload-abort", cancelButtonClass: "ajax-file-upload-cancel", dragDropContainerClass: "ajax-upload-dragdrop", dragDropHoverClass: "state-hover", errorClass: "ajax-file-upload-error", uploadButtonClass: "ajax-file-upload", dragDropStr: "Drag & Drop Files", uploadStr:"Upload", abortStr: "Abort", cancelStr: "Cancel", deleteStr: "Delete", doneStr: "Done", multiDragErrorStr: "Multiple File Drag & Drop is not allowed.", extErrorStr: "is not allowed. Allowed extensions: ", duplicateErrorStr: "is not allowed. File already exists.", sizeErrorStr: "is not allowed. Allowed Max size: ", uploadErrorStr: "Upload is not allowed", maxFileCountErrorStr: " is not allowed. Maximum allowed files are:", downloadStr: "Download", customErrorKeyStr: "jquery-upload-file-error", showQueueDiv: false, statusBarWidth: 400, dragdropWidth: 400, showPreview: false, previewHeight: "auto", previewWidth: "100%", extraHTML:false, uploadQueueOrder:'top', headers: {} }, options); this.fileCounter = 1; this.selectedFiles = 0; var formGroup = "ajax-file-upload-" + (new Date().getTime()); this.formGroup = formGroup; this.errorLog = $("
"); //Writing errors this.responses = []; this.existingFileNames = []; if(!feature.formdata) //check drag drop enabled. { s.dragDrop = false; } if(!feature.formdata || s.maxFileCount === 1) { s.multiple = false; } $(this).html(""); var obj = this; var uploadLabel = $('