Drag and Drop Multiple File Upload – Contact Form 7 - Version 1.3.1

Version Description

  • Fixed - Browser Compatibility ( Error Uploading files in Edge, Safari and Internet Explorer )
  • Improved - Removed error text if there are muliple error ( File upload validation )
Download this release

Release Info

Developer glenwpcoder
Plugin Icon 128x128 Drag and Drop Multiple File Upload – Contact Form 7
Version 1.3.1
Comparing to
See all releases

Code changes from version 1.3.0 to 1.3.1

assets/js/codedropz-uploader-min.js CHANGED
@@ -8,4 +8,4 @@
8
  */
9
 
10
  // CodeDropz Drag and Drop Plugin
11
- !function(e){e.fn.CodeDropz_Uploader=function(a){this.each(function(){var r=e(this),d=e.extend({handler:r,color:"#000",background:"",server_max_error:"Uploaded file exceeds the maximum upload size of your server.",max_file:r.data("max")?r.data("max"):10,max_upload_size:r.data("limit")?r.data("limit"):"5242880",supported_type:r.data("type")?r.data("type"):"jpg|jpeg|JPG|png|gif|pdf|doc|docx|ppt|pptx|odt|avi|ogg|m4a|mov|mp3|mp4|mpg|wav|wmv|xls",text:"Drag & Drop Files Here",separator:"or",button_text:"Browse Files",on_success:""},a),o=r.data("name")+"_count_files";localStorage.setItem(o,1);var s='<div class="codedropz-upload-handler"><div class="codedropz-upload-container"><div class="codedropz-upload-inner"><h3>'+d.text+"</h3><span>"+d.separator+'</span><div class="codedropz-btn-wrap"><a class="cd-upload-btn" href="javascript:void(0)">'+d.button_text+"</a></div></div></div></div>";d.handler.wrapAll('<div class="codedropz-upload-wrapper"></div>');var t=d.handler.parents("form"),n=d.handler.parents(".codedropz-upload-wrapper"),p=e('input[type="submit"]',t);d.handler.after(s),e(".codedropz-upload-handler",n).on("drag dragstart dragend dragover dragenter dragleave drop",function(e){e.preventDefault(),e.stopPropagation()}),e(".codedropz-upload-handler",n).on("dragover dragenter",function(a){e(this).addClass("codedropz-dragover")}),e(".codedropz-upload-handler",n).on("dragleave dragend drop",function(a){e(this).removeClass("codedropz-dragover")}),e("a.cd-upload-btn",n).on("click",function(e){e.preventDefault(),d.handler.val(null),d.handler.click()}),e(".codedropz-upload-handler",n).on("drop",function(e){l(e.originalEvent.dataTransfer.files,"drop")}),d.handler.on("change",function(e){l(this.files,"click")});var l=function(a,s){if(!(!a.length>1)){var p=new FormData;p.append("supported_type",d.supported_type),p.append("size_limit",d.max_upload_size),p.append("action","dnd_codedropz_upload"),p.append("type",s),e("span.has-error",d.handler).remove(),e.each(a,function(a,s){if(p.delete("upload-file"),localStorage.getItem(o)>d.max_file)return!e("span.has-error-msg",n).length>0&&(err_msg=dnd_cf7_uploader.drag_n_drop_upload.max_file_limit,n.append('<span class="has-error-msg">'+err_msg.replace("%count%",d.max_file)+"</span>")),!1;var l=i.createProgressBar(s),c=!1;if(s.size>d.max_upload_size&&(e(".dnd-upload-details",e("#"+l)).append('<span class="has-error">'+dnd_cf7_uploader.drag_n_drop_upload.large_file+"</span>"),c=!0),regex_type=new RegExp("(.*?).("+d.supported_type+")$"),!1!==c||regex_type.test(s.name.toLowerCase())||(e(".dnd-upload-details",e("#"+l)).append('<span class="has-error">'+dnd_cf7_uploader.drag_n_drop_upload.inavalid_type+"</span>"),c=!0),localStorage.setItem(o,Number(localStorage.getItem(o))+1),!1===c){p.append("upload-file",s);e.ajax({url:d.ajax_url,type:t.attr("method"),data:p,dataType:"json",cache:!1,contentType:!1,processData:!1,xhr:function(){var e=new window.XMLHttpRequest;return e.upload.addEventListener("progress",function(e){if(e.lengthComputable){var a=e.loaded/e.total,r=parseInt(100*a);i.setProgressBar(l,r)}},!1),e},complete:function(){i.setProgressBar(l,100)},success:function(a){a.success?e.isFunction(d.on_success)&&d.on_success.call(this,r,l,a):(e(".dnd-progress-bar",e("#"+l)).remove(),e(".dnd-upload-details",e("#"+l)).append('<span class="has-error">'+a.data+"</span>"),e('input[type="submit"]',t).removeClass("disabled").prop("disabled",!1))},error:function(a,r,o){e(".dnd-progress-bar",e("#"+l)).remove(),e(".dnd-upload-details",e("#"+l)).append('<span class="has-error">'+d.server_max_error+"</span>"),e('input[type="submit"]',t).removeClass("disabled").prop("disabled",!1)}})}})}},i={createProgressBar:function(a){var r=e(".codedropz-upload-handler",n),d="dnd-file-"+Math.random().toString(36).substr(2,9),s='<div class="dnd-upload-image"><span class="dnd-icon-blank-file"></span></div><div class="dnd-upload-details"><span class="name">'+a.name+" <em>("+i.bytesToSize(a.size)+')</em></span><a href="javascript:void(0)" title="Remove" class="remove-file" data-storage="'+o+'"><span class="dnd-icon-remove"></span></a><span class="dnd-progress-bar"><span></span></span></div>';return r.after('<div id="'+d+'" class="dnd-upload-status">'+s+"</div>"),d},setProgressBar:function(a,r){var d=e(".dnd-progress-bar",e("#"+a));return d.length>0&&(i.disableBtn(p),progress_width=r*d.width()/100,e("span",d).addClass("in-progress").animate({width:progress_width},10).text(r+"% "),100==r&&e("span",d).addClass("complete").removeClass("in-progress")),!1},bytesToSize:function(e){return 0===e?"0":(kBytes=e/1024,fileSize=kBytes>=1024?(kBytes/1024).toFixed(2)+"MB":kBytes.toFixed(2)+"KB",fileSize)},disableBtn:function(e){e.length>0&&e.addClass("disable").prop("disabled",!0)}}}),e(document).on("click",".dnd-icon-remove",function(r){var d=e(this),o=d.parents(".dnd-upload-status"),s=d.parents(".codedropz-upload-wrapper"),t=d.parent("a").attr("data-storage");return!(e("span.in-progress",o).length>0)&&(e(".has-error",o).length>0?(o.remove(),localStorage.setItem(t,Number(localStorage.getItem(t))-1),!1):(d.addClass("deleting").text("deleting..."),void e.post(a.ajax_url,{path:o.find('input[type="hidden"]').val(),action:"dnd_codedropz_upload_delete"},function(a){a.success&&(o.remove(),localStorage.setItem(t,Number(localStorage.getItem(t))-1),e(".dnd-upload-status",s).length<=1&&e("span.has-error-msg",s).remove())})))})}}(jQuery);
8
  */
9
 
10
  // CodeDropz Drag and Drop Plugin
11
+ !function(e){e.fn.CodeDropz_Uploader=function(a){this.each(function(){var r=e(this),d=e.extend({handler:r,color:"#000",background:"",server_max_error:"Uploaded file exceeds the maximum upload size of your server.",max_file:r.data("max")?r.data("max"):10,max_upload_size:r.data("limit")?r.data("limit"):"5242880",supported_type:r.data("type")?r.data("type"):"jpg|jpeg|JPG|png|gif|pdf|doc|docx|ppt|pptx|odt|avi|ogg|m4a|mov|mp3|mp4|mpg|wav|wmv|xls",text:"Drag & Drop Files Here",separator:"or",button_text:"Browse Files",on_success:""},a),o=r.data("name")+"_count_files";localStorage.setItem(o,1);var s='<div class="codedropz-upload-handler"><div class="codedropz-upload-container"><div class="codedropz-upload-inner"><h3>'+d.text+"</h3><span>"+d.separator+'</span><div class="codedropz-btn-wrap"><a class="cd-upload-btn" href="javascript:void(0)">'+d.button_text+"</a></div></div></div></div>";d.handler.wrapAll('<div class="codedropz-upload-wrapper"></div>');var t=d.handler.parents("form"),n=d.handler.parents(".codedropz-upload-wrapper"),p=e('input[type="submit"]',t);d.handler.after(s),e(".codedropz-upload-handler",n).on("drag dragstart dragend dragover dragenter dragleave drop",function(e){e.preventDefault(),e.stopPropagation()}),e(".codedropz-upload-handler",n).on("dragover dragenter",function(a){e(this).addClass("codedropz-dragover")}),e(".codedropz-upload-handler",n).on("dragleave dragend drop",function(a){e(this).removeClass("codedropz-dragover")}),e("a.cd-upload-btn",n).on("click",function(e){e.preventDefault(),d.handler.val(null),d.handler.click()}),e(".codedropz-upload-handler",n).on("drop",function(e){l(e.originalEvent.dataTransfer.files,"drop")}),d.handler.on("change",function(e){l(this.files,"click")});var l=function(a,s){if(!(!a.length>1)){var p=new FormData;p.append("supported_type",d.supported_type),p.append("size_limit",d.max_upload_size),p.append("action","dnd_codedropz_upload"),p.append("type",s),e("span.has-error",d.handler).remove(),e.each(a,function(a,s){if(void 0!==p.delete&&p.delete("upload-file"),localStorage.getItem(o)>d.max_file)return!e("span.has-error-msg",n).length>0&&(err_msg=dnd_cf7_uploader.drag_n_drop_upload.max_file_limit,n.append('<span class="has-error-msg">'+err_msg.replace("%count%",d.max_file)+"</span>")),!1;var l=i.createProgressBar(s),c=!1;if(s.size>d.max_upload_size&&(e(".dnd-upload-details",e("#"+l)).append('<span class="has-error">'+dnd_cf7_uploader.drag_n_drop_upload.large_file+"</span>"),c=!0),regex_type=new RegExp("(.*?).("+d.supported_type+")$"),!1!==c||regex_type.test(s.name.toLowerCase())||(e(".dnd-upload-details",e("#"+l)).append('<span class="has-error">'+dnd_cf7_uploader.drag_n_drop_upload.inavalid_type+"</span>"),c=!0),localStorage.setItem(o,Number(localStorage.getItem(o))+1),!1===c){p.append("upload-file",s);e.ajax({url:d.ajax_url,type:t.attr("method"),data:p,dataType:"json",cache:!1,contentType:!1,processData:!1,xhr:function(){var e=new window.XMLHttpRequest;return e.upload.addEventListener("progress",function(e){if(e.lengthComputable){var a=e.loaded/e.total,r=parseInt(100*a);i.setProgressBar(l,r)}},!1),e},complete:function(){i.setProgressBar(l,100)},success:function(a){a.success?e.isFunction(d.on_success)&&d.on_success.call(this,r,l,a):(e(".dnd-progress-bar",e("#"+l)).remove(),e(".dnd-upload-details",e("#"+l)).append('<span class="has-error">'+a.data+"</span>"),e('input[type="submit"]',t).removeClass("disabled").prop("disabled",!1))},error:function(a,r,o){e(".dnd-progress-bar",e("#"+l)).remove(),e(".dnd-upload-details",e("#"+l)).append('<span class="has-error">'+d.server_max_error+"</span>"),e('input[type="submit"]',t).removeClass("disabled").prop("disabled",!1)}})}})}},i={createProgressBar:function(a){var r=e(".codedropz-upload-handler",n),d="dnd-file-"+Math.random().toString(36).substr(2,9),s='<div class="dnd-upload-image"><span class="dnd-icon-blank-file"></span></div><div class="dnd-upload-details"><span class="name">'+a.name+" <em>("+i.bytesToSize(a.size)+')</em></span><a href="javascript:void(0)" title="Remove" class="remove-file" data-storage="'+o+'"><span class="dnd-icon-remove"></span></a><span class="dnd-progress-bar"><span></span></span></div>';return r.after('<div id="'+d+'" class="dnd-upload-status">'+s+"</div>"),d},setProgressBar:function(a,r){var d=e(".dnd-progress-bar",e("#"+a));return d.length>0&&(i.disableBtn(p),progress_width=r*d.width()/100,e("span",d).addClass("in-progress").animate({width:progress_width},10).text(r+"% "),100==r&&e("span",d).addClass("complete").removeClass("in-progress")),!1},bytesToSize:function(e){return 0===e?"0":(kBytes=e/1024,fileSize=kBytes>=1024?(kBytes/1024).toFixed(2)+"MB":kBytes.toFixed(2)+"KB",fileSize)},disableBtn:function(e){e.length>0&&e.addClass("disable").prop("disabled",!0)}}}),e(document).on("click",".dnd-icon-remove",function(r){var d=e(this),o=d.parents(".dnd-upload-status"),s=d.parents(".codedropz-upload-wrapper"),t=d.parent("a").attr("data-storage");return!(e("span.in-progress",o).length>0)&&(e(".has-error",o).length>0?(o.remove(),localStorage.setItem(t,Number(localStorage.getItem(t))-1),!1):(d.addClass("deleting").text("deleting..."),void e.post(a.ajax_url,{path:o.find('input[type="hidden"]').val(),action:"dnd_codedropz_upload_delete"},function(a){a.success&&(o.remove(),localStorage.setItem(t,Number(localStorage.getItem(t))-1),e(".dnd-upload-status",s).length<=1&&e("span.has-error-msg",s).remove())})))})}}(jQuery);
drag-n-drop-upload-cf7.php CHANGED
@@ -6,7 +6,7 @@
6
  * Description: This simple plugin create Drag & Drop or choose Multiple File upload in your Confact Form 7 Forms.
7
  * Text Domain: dnd-upload-cf7
8
  * Domain Path: /languages
9
- * Version: 1.3.0
10
  * Author: Glen Don L. Mongaya
11
  * Author URI: http://codedropz.com
12
  * License: GPL2
@@ -21,7 +21,7 @@
21
  define( 'dnd_upload_cf7', true );
22
 
23
  /** Define plugin Version */
24
- define( 'dnd_upload_cf7_version', '1.3.0' );
25
 
26
  /** Define constant Plugin Directories */
27
  define( 'dnd_upload_cf7_directory', untrailingslashit( dirname( __FILE__ ) ) );
6
  * Description: This simple plugin create Drag & Drop or choose Multiple File upload in your Confact Form 7 Forms.
7
  * Text Domain: dnd-upload-cf7
8
  * Domain Path: /languages
9
+ * Version: 1.3.1
10
  * Author: Glen Don L. Mongaya
11
  * Author URI: http://codedropz.com
12
  * License: GPL2
21
  define( 'dnd_upload_cf7', true );
22
 
23
  /** Define plugin Version */
24
+ define( 'dnd_upload_cf7_version', '1.3.1' );
25
 
26
  /** Define constant Plugin Directories */
27
  define( 'dnd_upload_cf7_directory', untrailingslashit( dirname( __FILE__ ) ) );
readme.txt CHANGED
@@ -3,14 +3,14 @@ Donate link : http://codedropz.com/donation
3
  Tags: drag and drop, contact form 7, ajax uploader, multiple file, upload, contact form 7 uploader
4
  Requires at least: 3.0.1
5
  Tested up to: 5.2.4
6
- Stable tag: 1.3.0
7
  Requires PHP: 5.2.4
8
  License: GPLv2 or later
9
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
10
 
11
  == Description ==
12
 
13
- Drag and Drop Uploader a simple Wordpress plugin extension for Contact Form 7, this will allow user to upload multiple files using **"Drag & Drop"** or **"Browse File"** in uploading area of your contact form.
14
 
15
  Here's a little [DEMO](http://codedropz.com/contact).
16
 
@@ -38,7 +38,7 @@ Checkout available features on **PRO version**.
38
 
39
  * Image Preview - Show Thumbnail for images
40
  * Auto Delete Files - After Form Submission
41
- - 1 hour, 4 hours, 8 hours or 1 day
42
  * Zip Files ( Compressed File )
43
  * Save Files To Media Library
44
  * Change Upload Directory
@@ -53,6 +53,11 @@ Checkout available features on **PRO version**.
53
 
54
  You can get [PRO Version here](https://www.codedropz.com/purchase-plugin/)!
55
 
 
 
 
 
 
56
  == Frequently Asked Questions ==
57
 
58
  = How can I send feedback or get help with a bug? =
@@ -67,7 +72,7 @@ To limit file size in `multiple file upload` field generator under Contact Form
67
 
68
  You can limit the number of files in your file upload by adding this parameter `max-file:3` to your shortcode :
69
 
70
- Example: (limit - 3): `[mfile upload-file-344 max-file:3]`
71
 
72
  = How can I Add or Limit file types =
73
 
@@ -111,6 +116,10 @@ To install this plugin see below:
111
 
112
  == Changelog ==
113
 
 
 
 
 
114
  = 1.3.0 =
115
  * Fixed - Multiple Drag & Drop fields in one form ( Validation Issues - Max File not working correctly )
116
  * Added - Added "deleted..." status when removing file.
3
  Tags: drag and drop, contact form 7, ajax uploader, multiple file, upload, contact form 7 uploader
4
  Requires at least: 3.0.1
5
  Tested up to: 5.2.4
6
+ Stable tag: 1.3.1
7
  Requires PHP: 5.2.4
8
  License: GPLv2 or later
9
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
10
 
11
  == Description ==
12
 
13
+ **Drag and Drop Multiple File Uploader** is a simple, straightforward WordPress plugin extension for Contact Form7, which allows the user to upload multiple files using the **drag-and-drop** feature or the common browse-file of your webform.
14
 
15
  Here's a little [DEMO](http://codedropz.com/contact).
16
 
38
 
39
  * Image Preview - Show Thumbnail for images
40
  * Auto Delete Files - After Form Submission
41
+ - 1 hour, 4 hours, 8 hours or 1 day etc
42
  * Zip Files ( Compressed File )
43
  * Save Files To Media Library
44
  * Change Upload Directory
53
 
54
  You can get [PRO Version here](https://www.codedropz.com/purchase-plugin/)!
55
 
56
+ ### Other Plugin You May Like
57
+
58
+ * [Drag & Drop Multiple File Upload - WPForms](https://www.codedropz.com/drag-drop-file-uploader-wpforms/)
59
+ An extension for **WPForms** - Transform your simple file upload into beautiful **"Drag & Drop Multiple File Upload"**.
60
+
61
  == Frequently Asked Questions ==
62
 
63
  = How can I send feedback or get help with a bug? =
72
 
73
  You can limit the number of files in your file upload by adding this parameter `max-file:3` to your shortcode :
74
 
75
+ Example: [mfile upload-file-344 max-file:3] - this option will limit the user to upload only 3 files.
76
 
77
  = How can I Add or Limit file types =
78
 
116
 
117
  == Changelog ==
118
 
119
+ = 1.3.1 =
120
+ * Fixed - Browser Compatibility ( Error Uploading files in Edge, Safari and Internet Explorer )
121
+ * Improved - Removed error text if there are muliple error ( File upload validation )
122
+
123
  = 1.3.0 =
124
  * Fixed - Multiple Drag & Drop fields in one form ( Validation Issues - Max File not working correctly )
125
  * Added - Added "deleted..." status when removing file.