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

📄 product_upimg.asp

📁 用ASP写的电子购物系统
💻 ASP
字号:
<%@ LANGUAGE = VBScript %>
<!--#INCLUDE FILE="include/manager.asp" -->
<% REM ######################################################################### %>
<% REM                                                                           %>
<% REM   PRODUCT_Image.ASP                                                       %>
<% REM   上传商品图片                                                            %>
<% REM                                                                           %>
<% REM   Copyright (c) 1996-98 Microsoft Corporation.  All rights reserved.      %>
<% REM                                                                           %>
<% REM ######################################################################### %>

<% REM   header: %>


<%functionno=2%>
<!--#INCLUDE FILE="checkuser.asp" -->
<%
dim errorList

iCount=trim(Session("product_id"))
if isnull(iCount) then
   errorList=errorList & "操作超时,请重新登录。<br>"
else

	set FileUp=server.createobject("ChinaASP.UpLoad")

	set f = fileup.Files(1) 
		if f.isempty=false then
		    image_filename="img"& iCount & "." &getFileExtName(f.fileName)
			f.saveas server.MapPath("../prodimg/") & "\img"& iCount &"."&getFileExtName(f.fileName)
		else
			image_filename="blank.gif"
		end if

end if
           
           
    cmdTemp.CommandText = "SELECT image_filename FROM product WHERE product_id = " & iCount

	Set recordSet = Server.CreateObject("ADODB.Recordset")
	recordSet.Open cmdTemp, , adOpenKeyset, adLockOptimistic
	if recordset.EOF then
	    errorList=errorList & "没有该商品。<br>"
	elseif not (image_filename="blank.gif" and  recordSet("image_filename")<>"" ) then
		recordSet("image_filename")=image_filename
		recordSet.Update
    end if
					
if erorList="" then 
    Response.Redirect "product_list.asp"
else%>
    <!--#INCLUDE FILE="error.asp" -->
<%end if 
 

'获得文件的后缀名
function getFileExtName(fileName)
	dim pos
	pos=instrrev(filename,".")
	if pos>0 then 
		getFileExtName=mid(fileName,pos+1)
	else
		getFileExtName=""
	end if
end function 

%>

⌨️ 快捷键说明

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