var filename = file.name; var index1 = filename.lastIndexOf("."); var index2 = filename.length; var ext = filename.substring(index1 + 1, index2);//后缀名