It should only allow png, jpg, jpeg, bmp file type.
How can we do that using element ui vuejs
beforeAvatarUpload(file) {
const isJPG = file.type === 'image/jpeg' || 'image/png';
const isLt2M = file.size / 1024 / 1024 < 2;
if (!isJPG) {
this.$message.error('Avatar picture must be JPG format!');
}
if (!isLt2M) {
this.$message.error('Avatar picture size can not exceed 2MB!');
}
return isJPG && isLt2M;
}
Does not work for me. Also it does not display me msword type in windows system. Don't know why
Please guide
Thanks