Skip to content

Commit

Permalink
add filter mimeType
Browse files Browse the repository at this point in the history
  • Loading branch information
rahmatalmubarak committed Oct 7, 2022
1 parent 446d516 commit 4fcae7e
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 6 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"spatie/laravel-backup": "^6.16|^8.1.0",
"unisharp/laravel-filemanager": "^2.4",
"webpatser/laravel-uuid": "^4.0",
"zircote/swagger-php": "^3.2"
"zircote/swagger-php": "^3.2|^4.2"
},
"require-dev": {
"phpunit/phpunit": "^9.5",
Expand Down
9 changes: 8 additions & 1 deletion src/resources/js/components/BadasoUploadFile.vue
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,14 @@ export default {
});
return;
}
if (!this.availableMimetypes.file.validMime.includes(files[0].type)) {
this.$vs.notify({
title: this.$t("alert.danger"),
text: "File type not allowed",
color: "danger",
});
return;
}
this.uploadFile(files[0]);
}
},
Expand Down
9 changes: 8 additions & 1 deletion src/resources/js/components/BadasoUploadFileMultiple.vue
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,14 @@ export default {
});
return;
}
if (!this.availableMimetypes.file.validMime.includes(file.type)) {
this.$vs.notify({
title: this.$t("alert.danger"),
text: "File type not allowed",
color: "danger",
});
return;
}
this.uploadFile(file);
}
}
Expand Down
11 changes: 9 additions & 2 deletions src/resources/js/components/BadasoUploadImage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,14 @@ export default {
});
return;
}
if (!this.availableMimetypes.image.validMime.includes(files[0].type)){
this.$vs.notify({
title: this.$t("alert.danger"),
text: "File type not allowed",
color: "danger",
});
return;
}
this.uploadImage(files[0]);
}
},
Expand Down Expand Up @@ -397,7 +404,7 @@ export default {
uploadImage(file) {
const files = new FormData();
files.append("upload", file);
files.append("type", "image");
files.append("type", file.type);
files.append("working_dir", this.getActiveFolder);
this.$api.badasoFile
.uploadUsingLfm(files)
Expand Down
9 changes: 8 additions & 1 deletion src/resources/js/components/BadasoUploadImageMultiple.vue
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,14 @@ export default {
});
return;
}
if (!this.availableMimetypes.image.validMime.includes(file.type)) {
this.$vs.notify({
title: this.$t("alert.danger"),
text: "File type not allowed",
color: "danger",
});
return;
}
this.uploadImage(file);
}
}
Expand Down

0 comments on commit 4fcae7e

Please sign in to comment.