我正在使用输入类型文件上传文件,我想检查名称是否包含印地文字体或英文字体。
下面是我的代码。
<!doctype html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script>
<script>
$("document").ready(function () {
$("#upload").change(function () {
var filename = $(this).val().replace(/^.*[\\\/]/, '')
alert(filename);
});
});
</script>
</head>
<body>
<div>
<input type="file" name="upload" id="upload" value="upload" />
</div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)