<!--#include file="BlogCommon.asp" -->
<!--#include file="common/function.asp" -->
<!--#include file="common/library.asp" -->
<!--#include file="common/upfile.asp" -->
<!--#include file="common/cache.asp" -->
<!--#include file="common/checkUser.asp" -->
<%
'==================================
'  附件上传页面
'    更新时间: 2005-10-20
'==================================
On Error Resume Next
%>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" rev="stylesheet" href="skins/<%=Skins%>/layout.css" type="text/css" media="all" /><!--层次样式表-->
<link rel="stylesheet" rev="stylesheet" href="skins/<%=Skins%>/typography.css" type="text/css" media="all" /><!--局部样式表-->
<link rel="stylesheet" rev="stylesheet" href="skins/<%=Skins%>/link.css" type="text/css" media="all" /><!--超链接样式表-->
<script type="text/javascript" src="common/common.js"></script>
</head>
<body class="attachmentBody">
<%
  Server.ScriptTimeOut = 999
  IF stat_FileUpLoad=true and memName<>empty Then
  IF Request.QueryString("action")="upload" Then
Dim upl,FSOIsOK
		FSOIsOK=1
Set upl=Server.CreateObject("Scripting.FileSystemObject")
		If Err<>0 Then
			Err.Clear
			FSOIsOK=0
		End If
		Dim D_Name,F_Name
		If FSOIsOK=1 Then
			D_Name="month_"&DateToStr(Now(),"ym")
			If upl.FolderExists(Server.MapPath("attachments/"&D_Name))=False Then
				upl.CreateFolder Server.MapPath("attachments/"&D_Name)
			End If
		Else
			D_Name="All_Files"
		End If
		Set upl=Nothing
Dim FileUP
Set FileUP=New Upload_File
FileUP.GetDate(-1)
Dim F_File,F_Type
Set F_File=FileUP.File("File")
F_Name=randomStr(1)&Year(now)&Month(now)&Day(now)&Hour(now)&Minute(now)&Second(now)&"."&F_File.FileExt
F_Type=FixName(F_File.FileExt)
IF F_File.FileSize > Int(UP_FileSize) Then
	Response.Write("<div style=""padding:6px""><a href='attachmentjpegimg.asp'>文件大小超出，请返回重新上传</a></div>")
ElseIF IsvalidFile(UCase(F_Type)) = False Then
	Response.Write("<div style=""padding:6px""><a href='attachmentjpegimg.asp'>文件格式非法，请返回重新上传</a></div>")
Else
	F_File.SaveAs Server.MapPath("attachments/"&D_Name&"/"&F_Name)
	response.write "<script>addUploadItem('"&F_Type&"','attachments/"&D_Name&"/"&F_Name&"')</script>" 
	Response.Write("<div style=""padding:6px""><a href='attachmentjpegimg.asp'>文件上传成功，请返回继续上传</a></div>")
End IF
		Set F_File=Nothing
		Set FileUP=Nothing
dim photo,logo,photopath,logopath
Set Photo = Server.CreateObject("Persits.Jpeg")
PhotoPath = Server.MapPath("attachments/"&D_Name&"/"&F_Name&"")
Photo.Open PhotoPath
Set Logo = Server.CreateObject("Persits.Jpeg")
LogoPath = Server.MapPath("images/imglogo.gif")
Logo.Open LogoPath 
Logo.Width = 168
Logo.Height = Logo.Width * Logo.OriginalHeight / Logo.OriginalWidth
Photo.Canvas.Pen.Color  = &H000000  
Photo.Canvas.Pen.Width  = 1    
Photo.Canvas.Brush.Solid = False  
Photo.DrawImage photo.width-168, photo.height-16, Logo,1.0
',&HFFFFFF
photo.Save Server.MapPath("attachments/"&D_Name&"/"&F_Name&"")
Set logo = Nothing 
Set photo = Nothing 
Response.Write("</td>")
Else

Response.Write("<form name=""frm"" enctype=""multipart/form-data"" method=""post"" action=""attachmentjpegimg.asp?action=upload""><input name=""File"" type=""File"" size=""28"" style=""font-size:12px;border-width:1px"">&nbsp;<input type=""Submit"" name=""Submit"" value=""确定上传"" class=""userbutton"">给图片增加<font color=""#FF0000"">图片水印</font>，服务器需要支持<font color=""#FF0000"">aspjpeg</font>组件</form>")
End IF
Else
Response.Write("<div style=""padding:6px;color:#f00"">对不起，你没有权限上传附件！</div>")
End IF
%>
