[Javascript] Get file extension from file path Turn Back
2020-03-05 15:28:19
function fileExt(file) {var extension = file.substr( (file.lastIndexOf('.') +1) );switch(extension) {case 'jpeg':case 'jpg':case 'png':case 'gif':return 1;break;case 'pdf':return 2;break;case 'xls':case 'xlsx':case 'doc':case 'docx':case 'zip':case 'rar':return 3;break;default:return 3;}}