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

📄 uploadsave.asp

📁 自己做的鞋业网站代码
💻 ASP
字号:
<!--#include FILE="upload.inc"-->
<!--#include FILE="setup.asp"-->
<html>
<head>
<title>File upload result</title>
<meta http-equiv="Content-Type" content="text/html; ">
<style type="text/css">
<!--
	body {  font-size: 9pt}
	td {  font-size: 9pt}
	a {  color: #000000; text-decoration: none}
	a:hover {  text-decoration: underline}
	.tx {  height: 16px; width: 30px; border-color: black black #000000; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 1px; border-left-width: 0px; font-size: 9pt; background-color: #eeeeee; color: #0000FF}
	.bt {  font-size: 9pt; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; height: 16px; width: 80px; background-color: #eeeeee; cursor: hand}
-->
</style>
</head>
<body topmargin="0" scroll= "no">
<table width="312" border="0" cellspacing="2" cellpadding="0" bordercolordark="#CCCCCC" bordercolorlight="#000000">
  <tr > 
    <td height="25" align="left" valign="middle" >
<%

dim upload,file,formName,iCount
set upload=new upload_5xSoft 				''建立上传对象

if right(formPath,1)<>"/" then formPath=formPath&"/"    ''在目录后加(/)
iCount=0
i=0

for each formName in upload.objFile ''列出所有上传了的文件
	i=i+1
 	set file=upload.file(formName)  ''生成一个文件对象
	if file.filesize=0 then
		HtmEnd "Please select a file to upload"
		set upload=nothing
		response.end
	end if
	if file.filesize>cint(uploadsize)*1024 then
	 	HtmEnd "Sorry,the file size is too large"
		set upload=nothing
		response.end
	end if
	if Instr(FileType,GetExtendName(file.FileName)) then
	else
		HtmEnd "Sorry,file format must be .jpg or .gif"
		set upload=nothing
		response.end
	end if

	file.FileName = year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&i&"."&right(file.FileName,3)
	dim file_system,sub_files,cur_folder,each_file
	set file_system=createobject("scripting.filesystemobject") 
	set cur_folder=file_system.getfolder(server.MapPath(c_path)) 
	set sub_files=cur_folder.files 
	
	for each each_file in sub_files 
		if instr(each_file.name,file.FileName)<>0 then 
			HtmEnd "您所上传的文件 <b> "&file.FileName&" </b> 已经存在,请将文件改名后上传!"
			set upload=nothing
			response.end
		end if
	next

	set each_file=nothing 
	set sub_files=nothing 
	set file_system=nothing  
	if file.FileSize>0 then         				''如果 FileSize > 0 说明有文件数据
		file.SaveAs Server.mappath(formPath&file.FileName)   	''保存文件
	  	response.write "<b>◇Upload successful◇</b>"
	end if
 	aa = file.filename
%>
	<script language="JavaScript" type="text/JavaScript">
		parent.document.form1.filename.value='<%=aa%>';
	</script>
<%
	iCount=iCount+1
	set file=nothing
next

set upload=nothing  ''删除此对象

sub HtmEnd(Msg)
	set upload=nothing
	response.write "&nbsp;&nbsp;"&Msg&"&nbsp;&nbsp;"
	response.write "<a href=""javascript:history.back();"">&nbsp;&nbsp;· go back ·</a></tr></table></body></htmL>"
	response.end
end sub

function GetExtendName(FileName)
	dim ExtName
	ExtName = LCase(FileName)
	ExtName = right(ExtName,3)
	ExtName = right(ExtName,3-Instr(ExtName,"."))
	GetExtendName = ExtName
end function
%>
      <a href="javascript:history.back();">· go back ·</a> </td>
    </tr>
</table>
</body>
</html>

⌨️ 快捷键说明

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