?? advuploadpicture_seav.asp
字號:
<!--#include file="../../conn/conn.asp"-->
<!--#include file="../../inc/safe.asp"-->
<!--#include FILE="../../inc/upload_5xsoft.inc"-->
<%
if Request.Cookies("globalec")("globalecmaster")="" or Request.Cookies("globalec")("masterflag")="" then
response.write "<script language='javascript'>"
response.write"this.location.href='../login.asp';</SCRIPT>"
response.end
end if
if instr(Request.Cookies("globalec")("masterflag"),"81")=0 then
response.redirect "../err.asp"
response.end
end if
Response.Buffer = true
Response.ExpiresAbsolute=now()-1
Response.Expires=0
Response.CacheControl="no-cache"
%>
<%
if Not ChkPost then
response.redirect ("../../login/chklogin.asp?login=4")
response.end
end if
Dim objFSO
%>
<html>
<head>
<title>
<%=webname%>_上傳圖片
</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" type="text/css" href="../css/style.css">
<style type="text/css">
<!--
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
background-color: #f1f3f5;
}
-->
</style>
</head>
<body>
<SCRIPT LANGUAGE="JavaScript">
<!-- Hide
function killErrors() {
return true;
}
window.onerror = killErrors;
// -->
</SCRIPT>
<%
set fs=server.CreateObject("scripting.filesystemobject")
set upload=new upload_5xSoft ''建立上傳對象
'--------將日期轉化成文件名--------
formPath="/UploadFile/"
aformPath="expouppic/"
''在目錄后加(/)
if right(formPath,1)<>"/" then formPath=formPath&"/"
if right(aformPath,1)<>"/" then aformPath=aformPath&"/"
set file=upload.file("picture") ''生成一個文件對象
if file.FileSize>0 then ''如果 FileSize > 0 說明有文件數據
if file.filesize>200000 then
response.write"<SCRIPT language=JavaScript>alert('上傳圖片大于規定(200K),請改變文件大小后重新上傳!');"
response.write"javascript:history.back(-1)</SCRIPT>"
response.end
end if
FileExt = Mid(file.Filename, InStrRev(file.Filename, ".")+1)
FileExt = FixName(FileExt)
If Not ( CheckFileExt(FileExt) and CheckFileType(File.FileType) ) Then
response.write"<SCRIPT language=JavaScript>alert('上傳圖片只支持 gif|jpg|jpeg|bmp|png 圖象文件!');"
response.write"javascript:history.back(-1)</SCRIPT>"
response.end
end if
thename=aformPath&MakedownName()&"."&FileExt
file2=server.MapPath(file2)
if fs.FileExists(file2) then
fs.DeleteFile file2,true
end if
'開始判斷會員圖片目錄是否存在
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
If objFSO.FolderExists(Server.MapPath(""&formPath&""&aformPath&"")) Then'如果存在就直接保存圖片
file.SaveAs Server.mappath(formPath&thename)
Else
objFSO.CreateFolder(Server.MapPath(""&formPath&""&aformPath&""))'不存在就建一個目錄
file.SaveAs Server.mappath(formPath&thename)
End If
Set objFSO = Nothing '釋放 FileSystemObject 對象實例內存空間
imgs=thename
else
response.write"<SCRIPT language=JavaScript>alert('上傳圖片為空或圖片太大!');"
response.write"javascript:history.back(-1)</SCRIPT>"
response.end
end if
response.write"<font color=""red"">上傳標題圖片成功</font>"
%>
<script>
parent.document.form.picture.value="<%=imgs%>";
</script>
</html>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -