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

📄 upsavepic2.asp

📁 这是一个物流网站的源代码
💻 ASP
字号:
<style type="text/css">
<!--
body {
	FONT-SIZE: 9pt; color:#FF0000;
	background-color: #f0f0f0;
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;

}
.bt1 {  font-size: 9pt; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; height: 16px; width: 60px; background-color:#ffffff; cursor: hand}
-->
</style><%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%server.scripttimeout=9999%>
<!-- #include file="Upload.asp" -->
<script>parent.document.form1.Submit.disabled=false;</script>
<%

call upload_0()
sub upload_0()
dim upload,file,fpath,filename,fileext
set upload=new UpFile_Class '建立对像
n=5120  
sizes=n*1024
'300kb大小
upload.getdate(sizes)

if upload.err>0 then
select case upload.err
case 1
Response.Write "请先选择你要上传的文件 [ <a href=# onclick=history.go(-1)>重新上传</a> ]"
case 2
	Response.Write "文件大小超过了限制 "&n&"K [ <a href=# onclick=history.go(-1)>重新上传</a> ]"
	
end select
exit sub

else

fpath=upload.form("filepath")
if right(fpath,1)<>"/" then fpath=fpath&"/"

for each formname in upload.file '列出上传的文件
set file=upload.file(formname) '生成文件对象
fileext=lcase(file.fileExt)

if fileext="asp" or fileext="aspx" or fileext="asa" then 
checkfileext(fileext)=false
end if

if checkfileext(fileext)=false then
response.write "格式不正确 <a href=# onclick=history.go(-1)>重新上传</a>"
response.end
end if

filesize=file.filesize
Sizes=formatnumber(file.filesize/1024,0)&"KB"
randomize
newname=year(now())&month(now())&day(now)&hour(now())&minute(now())&second(now())&left(clng((10000-1000+1)*rnd+1),4)
filename=newname&"."&file.fileExt
names=filename
filename=fpath&filename
if filesize>0 then

file.SaveToFile server.mappath(filename)
pic=upload.form("pic")
num=upload.form("tup")
response.write "<script>parent.document.forms[0]."&upload.form("tup")&".value='"&names&"'</script>"
response.write "<script>parent.document.forms[0]."&upload.form("tup2")&".value='"&Sizes&"'</script>"
response.write "上传文件成功"
'response.end
end if

set file=nothing
next
end if
end sub

function checkfileext(fileext)

fileext=replace(lcase(fileext),".",",")
filepic=".gif.jpg.png.bmp.jpeg.rar.zip.exe.doc.xls.chm.hlp.pdf.swf"
filepic2=split(filepic,".")
for i=0 to ubound(filepic2)
if fileext=trim(filepic2(i)) then
checkfileext=true
exit function
else
checkfileext=false
end if
next
end function

%>



⌨️ 快捷键说明

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