<%data_path="../"%>
<!-- #include File="../conn/conn.asp" -->
<!-- #include File="class_upfile.asp" --> 
<!-- #include File="safe.asp" -->
<!-- #include File="filesystem.asp" -->
<!-- #include File="uppicconfig.asp" -->
   <html>
	<head>
	<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
	<title> 文件上传</title>
	<style type="text/css">
<!--
/* 全局 */
div,ul,ol,form {margin:0;padding:0;}
input {font-family:Arial,Helvetica,sans-serif;font-size:12px;height:20px;}

body {
text-align: center;
margin:0;
font-family:Arial,Helvetica,sans-serif;
font-size: 12px;
line-height: 150%;
word-break:break-all;
}
-->
</style>
</head>
<body>
	
 <%
  '允许会员和管理员上传
  if issession=0 then
  globalecmaster=request.Cookies("username") '验证管理员
  userid=request.Cookies("Yxmemberid")   '验证会员
  else
  globalecmaster=session("globalecmaster")
  userid=session("id")
  end if
  
   if  globalecmaster<>""    or userid<>"" then
    
	'^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
	'检查会员
	sql2="select * from Websen_corporation where id="&userid&""
    Set rs2= Server.CreateObject("ADODB.Recordset") 
    rs2.open sql2,conn,1,1
	Qymc=rs2("Qymc")
	rs2.close
	'--------------------------------------------------------检查水印
	sql="select * from websen_Watermark" 
	Set rs2= Server.CreateObject("ADODB.Recordset")  
	rs2.open sql,conn,1,1
	
	 
	if Fy_In=1 then
 
	
    '^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

   guser=Replace_Text(Request("guser"))
   utype=Replace_Text(Request("utype"))
   if utype="web" then                              '网站公告等的图片处理
   upload_dir="../UploadFile/aboutuppic/"
   elseif utype="ad" then 
   upload_dir="../UploadFile/AD/"
   elseif utype="guser" then                       '总后台修改产品图片
   upload_dir="../Vipcom/"&guser&"/"
    set objFSO=YXFSO
    If objFSO.FolderExists(Server.MapPath("../Vipcom/"&guser&"")) Then'如果存在就直接保存图片
    Else
   objFSO.CreateFolder(Server.MapPath("../Vipcom/"&guser&""))'不存在就建一个目录
   End If
   Set objFSO = Nothing                            '释放 FSO 对象实例内存空间
   elseif utype="kind" then
   upload_dir="../UploadFile/infouppic/"           '行业资讯图片
   elseif utype="expkind" then
   upload_dir="../UploadFile/expouppic/"           '展会资讯图片
   elseif utype="vipinfo" then
   upload_dir="../UploadFile/vipinfopic/"
   elseif utype="vipgrade" then               '展会资讯图片
   upload_dir="../UploadFile/vipgrade/"
   end if
   
     '是否允许多次上传^^^^^^^^^^^^^^^^^^^
     istwo=Replace_Text(Request("istwo"))
	'^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
	'返回的值处理^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    tMode=Replace_Text(Request("tMode"))
	'^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  If Replace_Text(Request("t"))="1" Then
	Upfile_Main()
   Else
 	Main()
  End If
  Sub Main()
	Dim PostRanNum,PostRan22
	Randomize
	PostRanNum = Int(9000*rnd)+1000
 %>
	<ul style="margin:0px;text-align: left;width:100%;"> 
     <form name="myform" method="post" action="upload.asp?t=1&tMode=<%=tMode%>&istwo=0&utype=<%=utype%>&guser=<%=guser%>" enctype="multipart/form-data">
	
	 <INPUT TYPE="hidden" NAME="UploadCode" value="<%=PostRanNum%>">
	 <input type="hidden" name="act" value="upload">
 	 <input type="file" name="uploadfile">
	 <input type="hidden" name="fname">
	 <input type="submit" name="Ok" value="上传" ><br />
       </form>
	</ul>
</body>
</html>
<%
   End Sub
   Sub Upfile_Main()	
%>
<ul style="margin:0px;text-align: left;width:100%;"> 
<%
 UploadFile
%>
</ul>
</body>
</html>
<%
  End Sub
  Sub UploadFile()
       	Server.ScriptTimeOut=9999999
 	Dim Upload,FilePath,FormName,File,F_FileName,F_Viewname
    upfiletype=replace(upfiletype,"|",",")
        FilePath=upload_dir
   	Set Upload = New UpFile_Cls
 		Upload.UploadType			= 0										'设置上传组件类型
 		Upload.UploadPath			= FilePath								'设置上传路径
		Upload.MaxSize				= maxsize				                '单位 KB
		Upload.InceptMaxFile		= 8										'每次上传文件个数上限
		Upload.InceptFileType		= upfiletype							'设置上传文件限制

		
		Upload.RName				= ""
		Upload.ChkSessionName		= "UploadCode"	
	'-------------------------------------------------------------------------------
 	
 		
		
	'--------------------------------------------------------------------------------
 		'执行上传
		Upload.SaveUpFile
		 
		If Upload.ErrCodes<>0 Then
 			Response.write "错误："& Upload.Description & "[ <a href='upload.asp?tMode="&tMode&"&istwo=1&utype="&utype&"&guser="&guser&"'>重新上传</a> ]"
			Exit Sub
		End If
		If Upload.Count > 0 Then
			For Each FormName In Upload.UploadFiles
				Set File = Upload.UploadFiles(FormName)
				F_FileName = FilePath & File.FileName
	 if Watermark="1" then 
Watermarkings rs2("Choose"),(F_FileName),rs2("Transparent"),Qymc,rs2("Jfamily"),rs2("nowColor"),rs2("Jsize"),rs2("UploadSetting"),rs2("Uploadjpg"),rs2("Jcolor_Width"),rs2("Jcolor_Height"),rs2("Jcolor_zy"),rs2("Jcolor_sx"),rs2("Jstyle"),rs2("Automati"),rs2("Custom")
    end if
  					if re<>"no" then
					
						select case file.filetype
						case 1
							If tMode="1" Then
 								Response.Write "<script>parent.form.picture.value='aboutuppic/" & File.FileName & "';</script>"
 							ElseIf  tMode="2" Then 
								Response.Write("D")
						 	Response.Write "<script>parent.form.picture.value='ss';</script>"

							ElseIf  tMode="3" Then 
						 	Response.Write "<script>parent.form.picture.value='infouppic/"& File.FileName&"';</script>"

							ElseIf  tMode="4" Then 
						 	Response.Write "<script>parent.form.picture.value='expouppic/"& File.FileName&"';</script>"
                            ElseIf  tMode="5" Then 
						 	Response.Write "<script>parent.form.picture.value='"&File.FileName&"';</script>"
                            ElseIf  tMode="6" Then 
						 	Response.Write "<script>parent.form.picture.value='"&guser&"/"&File.FileName&"';</script>"
							ElseIf  tMode="7" Then 
						 	Response.Write "<script>parent.form1.picture1.value='"&guser&"/"&File.FileName&"';</script>"
							ElseIf  tMode="8" Then 
						 	Response.Write "<script>parent.form.picture.value='vipinfopic/"& File.FileName&"';</script>"
							
							ElseIf  tMode="9" Then 
							
						 	Response.Write "<script>parent.form.ADSrc.value='"&HOPE_InstallDir&"Uploadfile/AD/"& File.FileName&"';</script>" 
							ElseIf  tMode="10" Then 
						 	Response.Write "<script>if(parent.Form1.picture.value.split(',').length>9){alert('对不起公司简介图片展示最多允许图片10张！');parent.document.all('zhu').style.display='none';};parent.Form1.picture.value+='"&File.FileName&",';</script>"
						    ElseIf  tMode="11" Then
						    Response.Write "<script>parent.form.picture.value='"&File.FileName&"';</script>"
							End If
						  case 2
							Response.Write "<script>parent.form.ADSrc.value='"&HOPE_InstallDir&"Uploadfile/AD/"& File.FileName&"';</script>" 
 						end select
					else
						
 					end if
					if istwo="1" then  
	 				Response.Write "文件："& File.FileName &"上传成功! "
 					else
				 	Response.Write "文件："& File.FileName &"上传成功!  "
 					end if
				Set File = Nothing
			Next
		Else
			Response.write "请正确选择要上传的文件。[ <a href='upload.asp?tMode=" & tMode &"'>重新上传</a> ]"
			Exit Sub
		End If
	Set Upload = Nothing
 End Sub
 else
  %>
  对不起！尚为开通上传功能！
  <%
 end if
 else
    response.write "<script language='javascript'>"
    response.write"this.location.href='../index.html';</SCRIPT>" 
    response.end
   end if
   rs2.close
 %>