upfile_1.asp

来自「关于网络渗透技术的详细讲解」· ASP 代码 · 共 76 行

ASP
76
字号
<!--#include file="upload_wj.inc"-->
<style>
td{font-size:9pt;line-height:120%;color:#353535} 
body{font-size:9pt;line-height:120%} 

a:link          { color: #000000; text-decoration: none }
a:visited       { color: #000000; text-decoration: none }
a:active        { color: #000000; text-decoration: none }
a:hover         { color: #336699; text-decoration: none; position: relative; right: 0px; top: 1px }
</style>
<%
set upload=new upload_file
if upload.form("act")="uploadfile" then
	filepath=trim(upload.form("filepath"))
	filelx=trim(upload.form("filelx"))
	
	i=0
	for each formName in upload.File
		set file=upload.File(formName)
 
 fileExt=lcase(file.FileExt)	'得到的文件扩展名不含有.
 if file.filesize<100 then
 	response.write "<span style=""font-family: 宋体; font-size: 9pt"">请先选择你要上传的文件! [ <a href=# onclick=history.go(-1)>重新上传</a> ]</span>"
	response.end
 end if
 if filelx<>"xml" then 
 	response.write "<span style=""font-family: 宋体; font-size: 9pt"">该文件类型不能上传! [ <a href=#     onclick=history.go(-1)>重新上传</a> ]</span>"
	response.end
 end if
 if filelx="xml" then
	if fileext<>"xml" and (fileext<>"dtd") then
		response.write "<span style=""font-family: 宋体; font-size: 9pt"">只能上传后缀为xml和dtd的文件! [ <a href=# onclick=history.go(-1)>重新上传</a> ]</span>"
		response.end
	end if
 end if
 
 if filelx="xml" then
	if file.filesize>(10000*1024) then
		response.write "<span style=""font-family: 宋体; font-size: 9pt"">最大只能上传 10M 的文件! [ <a href=# onclick=history.go(-1)>重新上传</a> ]</span>"
		response.end
	end if
 end if
 

vfname = file.FileName
fname = vfname
 filename=filepath&fname
%>
<%
 if file.FileSize>0 then         ''如果 FileSize > 0 说明有文件数据
  'file.SaveAs Server.mappath(filename)   ''保存文件
  file.SaveToFile Server.mappath(FileName)
  'response.write file.FileName&"  上传成功!  <br>"
  'response.write "新文件名:"&FileName&"<br>"
  'response.write "新文件名已复制到所需的位置,可关闭窗口!"
  if filelx="swf" then
      response.write "<script>window.opener.document."&upload.form("FormName")&".size.value='"&int(file.FileSize/1024)&" K'</script>"
  end if
  response.write "<script>window.opener.document."&upload.form("FormName")&"."&upload.form("EditName")&".value='"&FileName&"'</script>"
%>
<%
 end if
 set file=nothing
	next
	set upload=nothing
end if
%>
<script language="javascript">
window.alert("文件上传成功!谢谢合作!");
window.close();
</script>




⌨️ 快捷键说明

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