⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 upfile.asp

📁 qqMail的在线编辑器。 使用javascript构成。 比较简洁
💻 ASP
字号:
<%
OnUrl=Lcase(Request.ServerVariables("SERVER_NAME"))
PrevUrl=Lcase(request.servervariables("http_referer"))
IF instr(PrevUrl,OnUrl)=0 Then
    response.Write "<script language='javascript'>alert('非法操作!');history.go(-1);</script>"
    response.End()
End IF

Server.ScriptTimeOut=5000
%>
<!--#include FILE="UpLoadClass.asp"-->
<%
	Sub CreateFolder(strFolder)
	    strTestFolder = Server.Mappath(strFolder)
 	   Set objFSO = CreateObject("Scripting.FileSystemObject")
	    If not objFSO.FolderExists(strTestFolder) Then
	      strTestFolder = Server.Mappath(strFolder)
	      Set objFSO = CreateObject("Scripting.FileSystemObject")
	     objFSO.CreateFolder(strTestFolder)
	     Set objFSO = Nothing
	   End If
	End Sub

	dim CaiDao,FilePath,DayPath,FileName,UrlFile,UrlFiles,UrlPath
	
    FilePath  = "Api_Uppic/"
    DayPath   = year(now())&"-"&month(now())&"-"&day(now())	
	FilePath1 = "../../"&FilePath&DayPath&"/"
    CreateFolder(FilePath1)

	set CaiDao=new UpLoadClass'建立上传对象
	CaiDao.FileType="gif/jpg/png" 'gif/jpg/png
	CaiDao.SavePath = FilePath1 '设置服务器文件保存路径
	CaiDao.Charset="gb2312"'设置字符集
	CaiDao.Open() '打开对象

%>
<!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>
<meta http-equiv="Content-Type" content="text/html;charset=gb2312" />
<title>上传文件</title>
<style type="text/css">
 body {font:12px Tahoma;font-family:"宋体";margin:0px;background:#FFF;}
 body,form,ul,li,p,dl,dd,dt,h,td,th,h3{padding:0;font-size:12px;color:#444;}
</style>
</head>
<body>
<%
	FileName = FilePath&DayPath&"/"&CaiDao.Form("file")
	
	UrlFile  = Lcase("http://"&Request.ServerVariables("HTTP_HOST")&request.ServerVariables("PATH_INFO"))
	UrlFile  = split(UrlFile,"/upapi/upfile.asp")
	UrlFiles = split(UrlFile(0),"/")
	UrlPath  = ""
	For j=0 to UBound(UrlFiles)-1
	    UrlPath = UrlPath&UrlFiles(j)&"/"
	Next		
	response.Write "<script language=javascript>"&vbCrLf
	response.Write "window.parent.document.getElementById('picture').value='"&UrlPath&FileName&"';"&vbCrLf
	response.Write "window.location.href='upload.asp';"&vbCrLf
	response.Write "</script>"&vbCrLf
%>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -