📄 demo4.asp
字号:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>XUploadFiles 功能演示</title>
<script language="javascript">
function set_para()
{
var obj = xu_find();
if (obj != null)
{
obj.clearformitem(); // 清空插件内的表单项目
obj.addformitem("username",form1.username.value); // 增加表单项:username
obj.addformitem("password",form1.password.value); // 增加表单项:password
obj.setpath (form1.subpath.value); // 设置上传文件的路径
return true;
}
return false;
}
function xu_check()
{
var obj = xu_find();
if (obj != null)
{
var str = form1.textbox1.value;
if (str.indexOf(":") > 0) // 检查是否已经上传过文件
{
set_para();
str = obj.uploadfile();
}
if (str != "") return true;
}
return false;
}
</script>
</head>
<body bgcolor="#cceeff">
<form name="form1" method="post" action="demo4.asp" onSubmit="return xu_check();" id="form1">
<table width="100%" border="1">
<tr>
<td align="center"><span style="FONT-SIZE: 26px; COLOR: #770000">演示4:带验证信息的上传演示</span></td>
</tr>
<tr>
<td><blockquote>
<p> </p>
<p>文件说明:
<input name="title" type="text" value="Form 表单信息处理" id="title" />
</p>
<p>上传位置:
<select name="subpath" id="subpath">
<option selected="selected" value="myfiles">myfiles</option>
<option value="images">images</option>
<option value="document">document</option>
<option value="excel">excel</option>
</select>
</p>
<p>上传用户:
<input name="username" type="text" id="username" />
(<span style="color:blue"> guest </span>)</p>
<p>上传密码:
<input name="password" type="password" id="password" />
(<span style="color:blue"> 8888 </span>)</p>
<p>上传文件: <span style="DISPLAY: none">
<object id="uploadid" classid="clsid:18B9E4BF-F21F-46B9-AD50-5CA62145426A" codebase="http://www.blue999.com/xuploadfiles/activex/xuploadfiles.cab">
<param name="Action" value="xu_demo4.asp">
<param name="Bind" value="textbox1">
</object>
</span>
<script language="javascript" src="xuploadfiles.js"></script>
<textarea name="textbox1" rows="1" cols="50" wrap="off" readonly="readonly" id="textbox1" style="OVERFLOW-X: hidden"><% =Request.Form("textbox1") %>
</textarea>
<input onClick="xu_selectfiles();" type="button" value="浏览..." />
</p>
<p>
<input type="submit" name="ok" value="提交" id="ok" />
<input onClick="xu_reset();" type="reset" value="重置" />
<input onClick="javascript:history.go(-1);" type="button" value="返回" />
</p>
<p> </p>
</blockquote></td>
</tr>
<tr>
<td style="COLOR: red;"><%
If Request.Form("textbox1") <> "" Then
Dim namearray,count,i
Dim fileinfo,countinfo
namearray = Split(Request.Form("textbox1"),vbLf) ' 多个文件名之间使用换行符(vbLf)分割
count = UBound(namearray)
Response.Write("<p>共上传 " & (count + 1) & " 个文件</p>")
Response.Write("<p><ol>")
For i = 0 To count
Response.Write("<li>")
fileinfo = Split(namearray(i),"#") ' 文件信息格式:文件名#文件类型#文件大小
countinfo = UBound(fileinfo) + 1
If countinfo > 0 Then Response.Write("<a href='" & fileinfo(0) & "'>" & fileinfo(0) & "</a>")
If countinfo >= 3 Then Response.Write("," & fileinfo(1) & "," & fileinfo(2) & " Bytes")
Response.Write("</li>")
Next
Response.Write("</ol></p>")
End If
%></td>
</tr>
</table>
</form>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -