Browse Source

Limit on image size when uploading

master
GJWilliams87 4 years ago
parent
commit
fcf21dac8f
1 changed files with 9 additions and 0 deletions
  1. 9
    0
      src/components/property/propertyImage.vue

+ 9
- 0
src/components/property/propertyImage.vue View File

75
 
75
 
76
       const files = e.target.files || e.dataTransfer.files;
76
       const files = e.target.files || e.dataTransfer.files;
77
 
77
 
78
+      for (let i = 0; i < files.length; i++) {
79
+        if (files[i].size > 1048576) {
80
+          alert(
81
+            "One or more of your images are over 1 mb size. Please ensure that all your files are under 1 mb in size."
82
+          );
83
+          return;
84
+        }
85
+      }
86
+
78
       this.images = [];
87
       this.images = [];
79
       Array.prototype.push.apply(this.images, files);
88
       Array.prototype.push.apply(this.images, files);
80
       if (!this.images.length) return;
89
       if (!this.images.length) return;

Loading…
Cancel
Save