📄 up3.asp
字号:
<!--#include file="../Session.asp"-->
<link href="../../css/site.css" rel="stylesheet" type="text/css">
<%
'---------------------------要改的地方(由此文件的路径决定)----------------
'2行(样式文件),10行form.对象名称.value(注意大小写),15行(临时文件),28行(上传路径)
'33行(年月文件夹路径),70行(cab文件),71行(asp文件),72行(上传文件大小),74行(充许的文件格式)
'----------------------------------------------------------------
if Request("Up")="Yes" and Request.Form("UpFile")<>"" then
'写入文本框
Response.write "<script>parent.form.Pic3.value='"&Split(Request.Form("UpFile"),"/./")(1)&"'</script>"
'成功提示
Response.Write("<table border=0 cellpadding=0 cellspacing=0 bgcolor=#BBD2D1 width='100%' height='30'><tr><td align=center> 上传成功 <input name=Submit type=button class=button onclick=javascript:window.history.go(-1) value=重新上传></td></tr></table>")
'删除临时文件
Dim TempFile_Del
MDBTempFile="../../Up.tmp" ' 请与YzShopCartFso.asp中的文件名保持一至
Set FSO = Server.CreateObject("Scripting.FileSystemObject")
TempFile_Del=server.mappath(MDBTempFile)
If FSO.FileExists(TempFile_Del) Then
FSO.DeleteFile (TempFile_Del),true
end if
Set FSO = nothing
'失败提示
elseif Request("Up")="Yes" and Request.Form("UpFile")="" then
Response.Write("<table border=0 cellpadding=0 cellspacing=0 bgcolor=#BBD2D1 width='100%' height='30'><tr><td align=center> <font color=#FF6600>上传失败</font> <input name=Submit type=button class=button onclick=javascript:window.history.go(-1) value=重新上传></td></tr></table>")
else
Dim UpFile
'文件上传路径,系统自动加上"年月"文件夹
UpFile="Pic/FirstPic/"
'以“年月”创建上传文件夹
'Dim objFSO,Fsofolder,YearMonth
'YearMonth=year(date)&right("00"&month(date),2)
'Set objFSO = Server.createObject("Scripting.FileSystemObject")
'FilePath=Server.MapPath("../../"&UpFile&YearMonth)
'If objFSO.FolderExists (FilePath)=False Then
' objFSO.createFolder (FilePath)
'End If'If err.number = 0 then:成功
'UpFile=UpFile&YearMonth
'Set objFSO = Nothing
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>YzShopCartUp</title>
<script language="javascript">
function selfile(oUpload,oText) // 选择一个文件
{
oText.innerText = oUpload.selectfile(); // 显示用户选择文件
}
function selfiles(oUpload,oText) // 选择多个文件
{
var re = /\+/g; // 匹配模式,多个文件名之间使用加号(+)分割
oText.innerText = oUpload.selectfiles().replace(re,"\n"); // 显示用户选择文件
}
function check_reply(oForm)
{
oForm.UpFile.innerText = UpLoadid.uploadfile(); // 获得远程文件地址
}
</script>
</head>
<body leftmargin="0" topmargin="0" onload="clearfile();">
<object id="UpLoadid" classid="clsid:18B9E4BF-F21F-46B9-AD50-5CA62145426A" height="0" width="0" codebase="../../Up.cab#Version=3,0,0,0">
<param name="Action" value="../../Up.asp">
<param name="MaxFileSize" value="51200">
<param name="SubPath" value="<%=UpFile%>">
<param name="AllowExt" value="png;gif;jpg">
</object>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<form method="post" action="?Up=Yes" onsubmit="return check_reply(this);">
<tr>
<td bgcolor="#BBD2D1">
<input name="UpFile" type="text" value="" size="25" readonly="readonly" class="input1">
<input type="button" class=button value="选择图片" onclick="selfile(UpLoadid,UpFile);">
<input type="submit" name="submit" class=button value="上 传"> <input type="reset" name="submit" class=button value="重 置" onclick="UpLoadid.reset();">
</td>
</tr>
</form>
</table>
</body>
</html>
<%end if%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -