48 lines
2.7 KiB
HTML
48 lines
2.7 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||
<head>
|
||
<title></title>
|
||
<script type="text/javascript" src="../Scripts/jquery.js"></script>
|
||
<script type="text/javascript" src="../Scripts/Verify.js"></script>
|
||
<link href="../Styles/Public.css" rel="stylesheet" type="text/css" />
|
||
</head>
|
||
<body>
|
||
<h1>文件类型验证</h1>
|
||
<h2>概述</h2>
|
||
<div class="desc">
|
||
<p>最常见的应用场景是文件上传,在控件上设置 <strong>fileallow</strong>或<strong>filelimit</strong>实现允许上传的文件类型,或禁止上传的文件类型。</p>
|
||
<p><input name="" type="file" fileallow="jpg|png"/>,只允许上传jpg与png图片</p>
|
||
<p><input name="" type="file" filelimit="exe|com|bat|js"/>,禁止上传可执行文件</p>
|
||
</div>
|
||
<h2>示例</h2>
|
||
<h3>1、允许上传的文件类型</h3>
|
||
<div class="desc">
|
||
<fieldset>
|
||
|
||
<pre><form onsubmit="alert('验证成功');return false;" place="right"><br /> <input name="" type="file" <strong>fileallow="jpg|png"</strong> class="fileinput" nullable="false" /><br /> <p><br /> <input type="submit" name="button" class="button" value="验证表单" verify="true"/><br /> </p><br /> </form></pre>
|
||
<form onsubmit="alert('验证成功');return false;" place="right">
|
||
<input name="" type="file" fileallow="jpg|png" class="fileinput" nullable="false" />
|
||
<p>
|
||
<input type="submit" name="button" class="button" value="验证表单" verify="true"/>
|
||
</p>
|
||
</form>
|
||
</fieldset>
|
||
|
||
</div>
|
||
<h3>2、禁止上传的文件类型</h3>
|
||
<div class="desc">
|
||
<fieldset>
|
||
|
||
<pre><form onsubmit="alert('验证成功');return false;" place="right"><br /> <input name="" type="file" <strong>filelimit="exe|com|bat|js"</strong> class="fileinput" nullable="false"/><br /> <p><br /> <input type="submit" name="button" class="button" value="验证表单" verify="true"/><br /> </p><br /> </form></pre>
|
||
<form onsubmit="alert('验证成功');return false;" place="right">
|
||
<input name="" type="file" filelimit="exe|com|bat|js" class="fileinput" nullable="false"/>
|
||
<p>
|
||
<input type="submit" name="button" class="button" value="验证表单" verify="true"/>
|
||
</p>
|
||
</form>
|
||
</fieldset>
|
||
|
||
</div>
|
||
</body>
|
||
</html>
|