Преглед изворни кода

Limit on image size when uploading

master
GJWilliams87 пре 4 година
родитељ
комит
fcf21dac8f
1 измењених фајлова са 9 додато и 0 уклоњено
  1. 9
    0
      src/components/property/propertyImage.vue

+ 9
- 0
src/components/property/propertyImage.vue Прегледај датотеку

@@ -75,6 +75,15 @@ export default {
75 75
 
76 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 87
       this.images = [];
79 88
       Array.prototype.push.apply(this.images, files);
80 89
       if (!this.images.length) return;

Loading…
Откажи
Сачувај