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;
}
javascript Check file type
Source: https://stackoverflow.com/questions/7977084/check-file-type-when-form-submit
Đăng ký:
Đăng Nhận xét (Atom)
Is it okay to use both fetchpriority="high" and loading="eager" in img tag?
https://stackoverflow.com/questions/77744344/is-it-okay-to-use-both-fetchpriority-high-and-loading-eager-in-img-tag Yes Fetchpriority and l...
-
letsencrypt "Certbot doesn't know how to automatically configure the web server on this system" (repusic.com) sudo yum inst...
-
https://medium.com/@mair.swartz/creating-xml-document-with-react-c6c37f5c608b I wanted to see if React could be used to compose anything mo...
-
Modify File Permissions with chmod | Linode Modify File Permissions with chmod The chmod command allows users to change read and write per...
Không có nhận xét nào:
Đăng nhận xét