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

📄 up_byshoppicpro2.asp

📁 模块及功能: 1.汽车新闻 分类.查询.翻页 2.出售信息 搜索.评估.地区展示.发布.展示.固顶.刷新 3.求购信息 发布.展示.固顶.刷新 3.加盟商家管理 注册.登录.信
💻 ASP
字号:
<!--#include file="byshop_conn6.asp"-->
<!--#include file="upload.inc"-->
<title>图片上传</title>
<%
set upload=new upload_file
if upload.form("act")="uploadfile" then
ServerName1=trim(upload.form("ServerName1"))
ServerName2=Cstr(Request.ServerVariables("SERVER_NAME"))
If Mid(ServerName1,8,len(ServerName2))<>ServerName2 Then
    Response.Write "路径有误,禁止从网站外部提交表单!"
     response.end
End if

classid=trim(upload.form("classid"))
	byshopfilepath=trim(upload.form("byshopfilepath"))
	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<>"swf") and (filelx<>"jpg") then 
 	response.write "<span style=""font-family: 宋体; font-size: 9pt"">该文件类型不能上传! [ <a href=# onclick=history.go(-1)>重新上传</a> ]</span>"
	response.end
 end if
 if filelx="swf" then
	if fileext<>"swf"  then
		response.write "<span style=""font-family: 宋体; font-size: 9pt"">只能上传swf格式的Flash文件! [ <a href=# onclick=history.go(-1)>重新上传</a> ]</span>"
		response.end
	end if
 end if
 if filelx="jpg" then
	if fileext<>"gif" and fileext<>"jpg"  then
		response.write "<span style=""font-family: 宋体; font-size: 9pt"">只能上传jpg或gif格式的图片! [ <a href=# onclick=history.go(-1)>重新上传</a> ]</span>"
		response.end
     	end if
 end if
 if filelx="swf" then
	if file.filesize>(3000*1024) then
		response.write "<span style=""font-family: 宋体; font-size: 9pt"">最大只能上传 3M 的Flash文件! [ <a href=# onclick=history.go(-1)>重新上传</a> ]</span>"
		response.end
	end if
 end if
 if filelx="jpg" then
	if file.filesize>(1000*1024) then
		response.write "<span style=""font-family: 宋体; font-size: 9pt"">最大只能上传 1000K 的图片文件! [ <a href=# onclick=history.go(-1)>重新上传</a> ]</span>"
		response.end
	end if
 end if

 randomize
 ranNum=int(90000*rnd)+10000
 filename2=byshopfilepath&year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&ranNum&".gif"

%>
 
<%
 if file.FileSize>0 then         ''如果 FileSize > 0 说明有文件数据
  'file.SaveAs Server.mappath(filename)   ''保存文件
  file.SaveToFile Server.mappath(FileName2)
  '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='"&FileName2&"'</script>"
%>
<%
 end if
 set file=nothing
	next
	set upload=nothing
	set rs=server.CreateObject("adodb.recordset")
		 	rs.open "select * from [managepic] ",conn,1,3
		 	rs.AddNew
		 	rs("url")=filename2
		 	rs("adddate")=now()
		 	rs("class")=classid
		 	rs("by_tongguo")=0
		 rs.Update
rs.Close
set rs=nothing
end if
%>
<script language="javascript">
window.alert("文件上传成功!请不要修改生成的链接地址!");
window.close();
</script>

 
  

⌨️ 快捷键说明

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