www.gusucode.com > CC校友录贴吧 CCBar源码程序asp编程 > user/user_show_upload_save.asp

    <%
'===================================================================
'= ASP FILENAME	: /user/user_show_upload_save.asp
'= CREATED TIME : 2006-6-24
'= LAST MODIFIED: 2006-6-24
'= VERSION INFO : CCASP Framework Ver 2.0.1 ALL RIGHTS RESERVED BY www.cclinux.com
'= DESCRIPTION  : 用户签名图保存
'= Change Log:
'===================================================================
%>

<!-- #include file = "../inc/customer/include_customer_action_execute.asp" -->
<!-- #include file = "./user_inc.asp" -->
<!-- #include file = "../inc/logic/logic_user.asp" -->
<!-- #include file = "../class/class_file_up.asp" -->
<%
'========================================================
'==   Action参数设置
'========================================================
'== 页面名
Const CONST_PAGE_FILE	= "user/user_show_upload_save.asp"

'== 页面标题/功能
Const CONST_PAGE_TITLE	= "用户签名图保存"

'== 功能函数名字空间
Const CONST_ACTION_FUNC	= "FormSaveShowUpload"

'== 相对根目录路径 
GBL_strHomeURL			= "../"

'== 页面构造
Call ActionBuild()

'== 请求校验与过滤
Call ActionFilter(CONST_PAGE_FILE,CONST_ACTION_FUNC)

'== 页面析构
Call ActionOver()

%>


<%
'===================================================================
'= Function    : FormSaveShowUpload()
'= Time		   : Created At 2006-6-24
'= Input       : None
'= Description : 用户签名图保存
'===================================================================
Function FormSaveShowUpload()
	
	Dim strOldPwd,strNewPwd,strNewPwd2,strPicName
	Dim strAddInfo

	'== 服务器端数据校验
	'If Not ServerDataCheck(arrUserShowUploadDataChk) Then
	'	Exit Function
	'End If

	Dim claUpLoad,objFileUp,iCount,strUpFilePath,intFileMaxSize,strFileType,intNameSet
	Dim intTypeFlag,strFormName

	strFormName = "file1"
	'== 设置文件类型
	strFileType = GBL_strAlbumFileType

	'== 设置文件上限
	intFileMaxSize = 50 * 1000 

	'== 设置文件保存路径
	strUpFilePath = GBL_strHomeUrl & "user/uploadFace/"

	Set claUpLoad = New classFileUpLoad
	iCount = 0
	strAddInfo = "NULL"

	For Each strFormName In claUpLoad.objFile '== 列出所有上传了的文件
		Set objFileUp = claUpLoad.file(strFormName)  '== 生成一个文件对象
		If objFileUp.FileSize > 0 Then   '== the file is not null
			If objFileUp.FileSize < intFileMaxSize Then 
				If strFileType <> "" Then	'== check the file type
					If Instr(strFileType,GetExtendName(objFileUp.FileName)) And CheckFileType(objFileUp.FileType) Then
						intTypeFlag = 1    
					 Else
						intTypeFlag = 0	
						strAddInfo = "不支持您所上传的文件类型:" & GetExtendName(objFileUp.FileName)
						Call GBL_objException.catchErr(E_USER_PUB,strAddInfo)
						
		Exit Function
	End If
				Else
					intTypeFlag = 1	
				End If

				If intTypeFlag = 1 Then 
					
					strPicName = GBL_intUserId & "." & GetExtendName(objFileUp.FileName)
					
					objFileUp.SaveAs Server.Mappath(strUpFilePath & strPicName) 
					iCount = iCount + 1

				End If
			Else
				strAddInfo = "文件大小超出限制,您最多可以上传 " & intFileMaxSize/1000	& "K字节的文件数据"
				Call GBL_objException.catchErr(E_USER_PUB,strAddInfo)
				Exit Function
			End If
		End If
		Set objFileUp = Nothing
	Next

	Set claUpLoad = Nothing 
	
	If iCount < 0 Then 
		Call GBL_objException.catchErr(E_USER_PUB,"上传文件失败")
		Exit Function
	End If

	GBL_objFormData.Item("UpFace") = strPicName
	If Not SaveUserSignLogic(GBL_intUserId,GBL_objFormData) Then
		Exit Function
	End If

	'== 成功处理
	Dim strHtmlCode,strSuccUrl
	strHtmlCode = "您的签名图修改成功"
	strSuccUrl = "user/user_show_upload_form.asp"
	Call SuccExecute(strHtmlCode,strSuccUrl)

End Function
%>