dusenyao 3 years ago
parent
commit
cc11895491
1 changed files with 16 additions and 4 deletions
  1. 16 4
      src/utils/validate.js

+ 16 - 4
src/utils/validate.js

@@ -29,8 +29,20 @@ export function twoDecimal(value) {
  * @param {String} fileName
  */
 export function isAllowFileType(fileName) {
-  let suffix = fileName.slice(fileName.lastIndexOf('.') + 1, fileName.length);
-  return ['mp3', 'mp4', 'doc', 'docx', 'pdf', 'ppt', 'xls', 'jpg', 'gif', 'png', 'txt'].includes(
-    suffix
-  );
+  let suffix = fileName.slice(fileName.lastIndexOf('.') + 1, fileName.length).toLowerCase();
+  return [
+    'mp3',
+    'mp4',
+    'doc',
+    'docx',
+    'pdf',
+    'ppt',
+    'pptx',
+    'xls',
+    'jpg',
+    'gif',
+    'png',
+    'txt',
+    'rtf'
+  ].includes(suffix);
 }