function getExtension(filename) {
var parts = filename.split('.');
return parts[parts.length - 1];
}
function isImage(filename) {
var ext = getExtension(filename);
switch (ext.toLowerCase()) {
case 'jpg':
case 'gif':
case 'bmp':
case 'png':
//etc
return true;
}
return false;
}
function isVideo(filename) {
var ext = getExtension(filename);
switch (ext.toLowerCase()) {
case 'm4v':
case 'avi':
case 'mpg':
case 'mp4':
// etc
return true;
}
return false;
}
Hiển thị các bài đăng có nhãn check file type. Hiển thị tất cả bài đăng
Hiển thị các bài đăng có nhãn check file type. Hiển thị tất cả bài đăng
javascript Check file type
Source: https://stackoverflow.com/questions/7977084/check-file-type-when-form-submit
Đăng ký:
Nhận xét (Atom)
xóa toàn bộ commit
Cách chuẩn & đơn giản nhất (Khuyến nghị) Mục tiêu Xóa toàn bộ commit history Giữ nguyên code hiện tại main chỉ còn 1 commit...
-
html5 video - What is a blob URL and why it is used? - Stack Overflow Blob URLs (ref W3C , official name) or Object-URLs (ref. MDN and ...
-
Source: https://indepth.dev/stop-using-shared-material-module/ This article describes an experiment that shows why using the SharedMate...
-
Source: https://www.infoworld.com/article/3206264/application-development/how-to-perform-partial-updates-to-rest-web-api-resources.html T...