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

📄 savereuploadphoto.asp

📁 ASP编写的一个公司网站的源程序
💻 ASP
字号:
<%@ Language=VBScript %>


<!--#include virtual="/Include/DBConn.asp"-->
<!--#include virtual="/Include/Const.asp"-->
<!--#include virtual="/Include/ChkSession.asp"-->
<!--#include virtual="/include/upload_5xsoft.inc"--> 
<!--#include virtual="/Include/FuncPub.asp"-->

<html>
<head>
<title>AddColumnUpdate</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="../Css/css.css" type="text/css">

</head>
<body>

<!-- 以下代码由程序自动生成 -->
<%

	Dim savepath,picfiledname,idfiledname,tablename,picid
	Dim fileup,sUpload,bUpload,pload,uploadpicname,uploadpicsize
	Dim strFullPath
	strFullPath = Request.ServerVariables("APPL_PHYSICAL_PATH")
	if Right(strFullPath,1) = "\" then
		strFullPath = left(strFullPath,len(strFullPath)-1)
	end if

	'创建文件上传对象
	'Set fileup = Server.CreateObject("SoftArtisans.FileUp")  
	Set fileup = New upload_5xsoft	
		savePath = ModifyInput(fileup.form("savePath"))
		tablename = ModifyInput(fileup.form("tablename"))
		PicID = ModifyInput(fileup.form("PicID"))
		picfiledname = ModifyInput(fileup.form("picfiledname"))
		idfiledname = ModifyInput(fileup.form("idfiledname"))

		Dim fso
		set fso = Server.CreateObject("Scripting.FileSystemObject")
		if FSO.FolderExists(strFullPath & savePath)=False then
			FSO.CreateFolder strFullPath & savePath
		end if
		set fso = nothing
	Dim fileupimg
	Set fileupimg = fileup.file("uploadpic")
	uploadpic = trim(fileupimg.filename)
	If uploadpic<>"" then
		IF UCASE(GetFileNameExt(uploadpic))<>"GIF" and UCASE(GetFileNameExt(uploadpic))<>"JPG" then
			Response.Write "<script language='javascript'>"
			Response.Write "alert('对不起!你上传的图片格式只能是GIF或JPG!');"
			Response.Write "window.history.go(-1);"
			Response.Write "</script>"
			Response.End
		End IF
		If fileupimg.filesize> UPLOAD_IMGMAXFILESIZE then
			Response.Write "<script language='javascript'>"
			Response.Write "alert('对不起!请将您的缩小图片控制在5M以下!');"
			Response.Write "window.history.go(-1);"
			Response.Write "</script>"
			Response.End
		End If
	Else
			Response.Write "<script language='javascript'>"
			Response.Write "alert('请上传图片!');"
			Response.Write "window.history.go(-1);"
			Response.Write "</script>"
			Response.End	
	End If	

	fileupimg.SaveAs strFullPath & savepath & uploadpic
	Conn.Execute "Update "&tablename&" Set "&picfiledname&"='"&Replace(savepath&uploadpic,"\","/")&"' where "&idfiledname&"="&picid&""
	If Err.number = 0 then

		Response.Write "<Script>alert('成功上传图片!');window.opener.location.reload();this.close();</Script>"

		'Response.Write "<Script>alert('成功上传图片!');window.opener.parent.location.reload();this.close();</Script>"
	Else
		Call MsgBack("预览图片上传失败!","5")
	End If	

%>
<!-- 代码结束 -->
<!--#include virtual="/Include/DBClose.asp"-->
</body>
</html>

⌨️ 快捷键说明

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