<!DOCTYPE>
<html>
<head>
<meta http-equiv="Content-type" content="text/html" charset="utf-8">
<title>check file</title>
</head>
<body>
<b>文件扩展名验证</b>
<input type="text" name="int" value="文件.php" onblur="check(this)" id="int">
<input type="button" value="检测" onclick="check_value()">
<script>
function check(obj){
if(obj.value == "" || obj.value.length<3){
alert("输入的长度不能小于3且不能为空!");
obj.focus();
}
}
function check_value(){
var str = $("int").value;
var repx = /\.(php|asp|jsp)$/i;
var type = str.substring(str.lastIndexOf("."),str.length);
if(type.match(repx) && str.lastIndexOf(".") != -1){
alert("文件扩展名正确");
$("int").focus();
}else{
alert("文件扩展名有误");
$("int").focus();
}
}
function $(obj){
return document.getElementById(obj);
}
</script>
</body>
</html>
function get_extension($file)
{
substr(strrchr($file, '.'), 1);
}
function get_extension($file)
{
return substr($file, strrpos($file, '.')+1);
}
function get_extension($file)
{
return end(explode('.', $file));
}
function get_extension($file)
{
$info = pathinfo($file);
return $info['extension'];
}
function get_extension($file)
{
return pathinfo($file, PATHINFO_EXTENSION);
}
$file_path = pathinfo('/www/htdocs/your_image.jpg');
echo "$file_path ['dirname']\n";
echo "$file_path ['basename']\n";
echo "$file_path ['extension']\n";
echo "$file_path ['filename']\n"; // only in PHP 5.2+
pathinfo($file, PATHINFO_EXTENSION | PATHINFO_FILENAME);
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有