JS截取文件名后缀

const fileName = file.lastIndexOf('.'); // 取到文件名开始到最后一个点的长度
const fileNameLen = file.length; // 取到文件名长度
const fileType = file.substring(fileName + 1, fileNameLen); //

 

posted @ 2019-11-15 14:55  顾非白  阅读(1978)  评论(0编辑  收藏  举报