<!--#include file="../Include/Char.asp" -->
<!--#include file="../Include/Conn.asp" -->
<!--#include file="../Include/upload_5xsoft.inc" -->
<%

 if trim(Request.Cookies("UserID")) = "" or trim(Session("UserID"))=""  THEN
     Response.Redirect("Login.asp")
	 Response.End()
   end if
ID = checkStr(Request.Cookies("UserID"))
  function makefilename(fname)
  fname = now()
  fname = replace(fname,"-","")
  fname = replace(fname," ","") 
  fname = replace(fname,":","")
  fname = replace(fname,"PM","")
  fname = replace(fname,"AM","")
  fname = replace(fname,"上午","")
  fname = replace(fname,"下午","")
  makefilename=fname
end function 

function GetExtendName(FileName)
dim ExtName
ExtName = LCase(FileName)
ExtName = right(ExtName,3)
ExtName = right(ExtName,3-Instr(ExtName,"."))
GetExtendName = ExtName
end function
%>


<%
ID = Request.Cookies("UserID")
if CheckStr(Trim(Request("uploadimage"))) = "OK" then

     
	  
      'if rs("logo")<>"" then
	  '        delfname=server.mappath("UpLoadLogoImages") & "\"&Rs("logo") 
     '         set TestFileObject=Server.Createobject("Scripting.FileSystemObject")
     '         if  TestFileObject.FileExists(delfname) then
     '          set NewFile=TestFileObject.getfile(delfname)
     '          Newfile.delete
	 '         end if
     'end if
	 
	  
dim upload,file,formName,formPath,iCount
set upload=new upload_5xSoft ''建立上传对象


 formPath="UpLoadLogoImages"
 if right(formPath,1)<>"/" then formPath=formPath&"/" 
  iCount=0

for each formName in upload.file ''列出所有上传了的文件
 set file=upload.file(formName)  ''生成一个文件对象
 
 if file.FileSize <= 0 then    ''如果 FileSize > 0 说明有文件数据
   call MsgBox("对不起，请选择上传图片",1)
   response.end
 else
   
   last=lcase(right(file.filename,4))
   if last <>".jpg" then
      call MsgBox("对不起，图片类型出错，请问重新上传",1)
	  response.end
   end if

   FileName1=file.FileName
   vfname = ID
   fname = vfname & "." & GetExtendName(file.FileName)
   filename=fname  
	 
  file.SaveAs Server.mappath(formPath&fname)   ''保存文件

   response.Cookies("UploadImage")=filename

 
  
        iCount=iCount+1
        set file=nothing
        end if
       Next


      set upload=nothing  ''删除此对象
      Htmend iCount&" 个文件上传结束!"
	  
	  SET rs=server.createobject("adodb.recordset")
      SQL="SELECT logo FROM  CityCard_League WHERE CompanyID ="&ID
      rs.Open SQL,conn,1,3 
	  rs("logo")=fname
	  rs.update
end if

sub HtmEnd(Msg)
 set upload=nothing
end sub


%>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<HTML xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="../css/Style.css" rel="stylesheet" type="text/css"><link href="../css/Menu.css" rel="stylesheet" type="text/css"><link href="../css/aCardList.css" rel="stylesheet" type="text/css"><SCRIPT src="../js/029bxw.js" type=text/javascript></SCRIPT>
</head>

<body bgcolor="f5f5f5" leftmargin="0" topmargin="0">
<% if Request.cookies("UploadImage")="" then%>
<br>
<br>
<form action="?uploadImage=OK" method="post" enctype="multipart/form-data" name="form1">
  <input type="file" name="file">
  <font size="2">
  <input type="submit" name="Submit" value="上传">
  <font color="#FF0000">Jpg、Gif 小于200K</font></font>
</form>
<%else
   Response.write "上传成功 <a href='Rest_UploadImage.asp' >重新上传</a>"
end if%>
</body>
</html>
