<!--#include file="Inc/Const.asp" -->
<!--#include file="Inc/iXs_clsUp.asp" -->
<%
Response.Buffer = True
Response.ExpiresAbsolute = Now() - 1
Response.Expires = 0
Response.CacheControl = "no-cache"
Server.ScriptTimeout = 9999

If iXs.IsSelfRefer = False Then	Call iXs.Alert("对不起，不允许外部调用！\n\n将返回本站首页！", iXs.Sys_Info(5), 0)

Dim M0, M1, M2, M3, M4, M5, M6, M7, M8, M9
Dim ObjUpType, bgColor, Wid
Dim Action
Dim n, Self_Referer
Dim iXs_UF, StrFile, UpLoaddingDate

' 上传接口背景颜色
bgColor = iXs.ReqStr("bgColor")
If bgColor = "" Then bgColor = "buttonface"
' 文件类型
ObjUpType = iXs.ReqNum("ObjUpType")
If ObjUpType = "" Then ObjUpType = 0
Action = iXs.ReqNum("Action")
If Action = "" Then Action = 0
' 目标位置
Wid = iXs.ReqNum("Wid")
If Wid = "" Then Wid = 0
' 上传进度数据文件名 为了适应多用户 多进程相互独立显示而增加
iXs.ReqNumLen = 18
UpLoaddingDate = iXs.ReqNum("UpLoaddingDate")
If UpLoaddingDate = "" Then UpLoaddingDate = 0

'M0 ' 文件名称
'M1 ' 扩展名称
'M2 ' 保存路径
'M3 ' MIME类型
'M4 ' 文件大小
'M5 ' 图片宽度
'M6 ' 图片高度
'M7 ' 本地路径
'M8 ' 上传方法
'M9 ' 原文件名

n = 0
Self_Referer = Request.ServerVariables("HTTP_REFERER")
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>中国企业港图文管理系统上传接口</title>
<style type="text/css">
	@charset "gb2312";
	body,td,th {color: #000000;font: 12px Verdana, Arial, Helvetica, sans-serif, "宋体"}
	body{margin:0px; background-color:<% = bgColor %>;}
	a:link {text-decoration: none; color: #0000FF;}
	a:visited {text-decoration: none; color: #0000FF;}
	a:hover {text-decoration: underline; color: #FF0000;}
	a:active {text-decoration: none; color: #880000;}
</style>
<script id="downLoadControl" language="JavaScript" type="text/javascript"></script>
<script language="javascript1.2">
<!--
	// 删除进度数据文件
	function downLoadData(url){
		try{downLoadControl.src = url;}
		catch(e){}
	}
//-->
</script>
<SCRIPT FOR="window" EVENT="onunload">
<!--
	// 当窗口强制卸载的时候删除进度数据文件
	downLoadData("iXs_StartUpLoad.asp?UpLoaddingDate=<% = UpLoaddingDate %>");
//-->
</SCRIPT>
</head>
<body>
<%
If Action = 1 Then
	Set iXs_UF = New iXs_ClsUp
	
	iXs_UF.TotalSize 	= iXs.Sys_Info(33)	' 上传总大小
	iXs_UF.MaxSize 		= iXs.Sys_Info(34)	' 单文件大小
	iXs_UF.FileType  	= iXs.Sys_Info(35)	' 文件类型
	iXs_UF.SavePath 	= "uploadFile/"	' 保存路径
	' 指定时区为服务器系统时区
	' 防止客户端变换时区造成附件命名可能出现的重复和混乱情况的发生
	iXs.TimeZone = iXs.Sys_Info(31)
	' 以服务器系统时区获取时间字符串
	iXs_UF.StrDate = iXs.FormatTime(Now(), 5)
	' 上传进度数据文件名
	iXs_UF.UpLoaddingDate = UpLoaddingDate
	' 打开上传对象
	iXs_UF.Open()
	
	If iXs_UF.Error = 1 then
		Response.Write("<br>数据大小超过限制，上传失败！")
	ElseIf iXs_UF.Error = 2 then
		Response.Write("<br>包含非法文件类型，上传失败！")
	ElseIf iXs_UF.Error = 3 then
		Response.Write("<br>数据大小超过限制，并包含非法文件类型，上传失败！")
	ElseIf iXs_UF.Error = 4 then
		Response.Write("<br>数据总数量超过限制，上传失败！")
	Else
		StrFile = iXs_UF.FileItem
		Call FileSave(StrFile)
	End If
	'Response.Write(M2)
	'Response.End()
		Response.Write "<script language=javascript>window.opener.document.form1.pic.value='"&M2&"';</script>"
		Response.End()
	Set Acc = Nothing
End If

Sub FileSave(StrFile)
	Dim i, FormName, IsRemote, Str
	Dim ID
	For i = 1 To UBound(StrFile)
		FormName = iXs_UF.FileItem(i)
		IsRemote = 0
		If iXs_UF.Form(FormName) <> "" Then
			n = n + 1
			M0 = iXs_UF.Form(FormName) ' 文件名称
			M1 = LCase(iXs_UF.Form(FormName & "_Ext")) ' 扩展名称
			M2 = Replace(iXs_UF.SavePath & iXs_UF.Form(FormName),"\","/") ' 保存路径
			M3 = iXs_UF.Form(FormName & "_Type") ' MIME类型
			M4 = iXs_UF.Form(FormName & "_Size") ' 文件大小
			M5 = iXs_UF.Form(FormName & "_Width") ' 图片宽度
			M6 = iXs_UF.Form(FormName & "_Height") ' 图片高度
			M7 = Replace(iXs_UF.Form(FormName & "_Path"), "\", "\\") ' 本地路径
			M8 = IsRemote ' 上传方法
			M9 = iXs_UF.Form(FormName & "_Name") ' 原文件名
		End If
	Next
End Sub
%>
</BODY>
</HTML>