<!-- #include file="../../Comm/upload_inc.asp" -->
<%
Sub ShowMsg(MsgStr , FileName)
	Response.Write("<script>alert('"& MsgStr &"');")
	If FileName = "" Then
		Response.Write("history.back();")
	ElseIf FileName = "Cls" Then
		Response.Write("window.close();")
	Else
		Response.Write("location.href='"& FileName &"';")
	End If
	Response.Write("</script>")
	Response.End()
End Sub

Dim EmpPic
Dim MyRequest,MyFile,MyFileName,MyFileExt,UpFileType,UpFileName

Set MyRequest = New upload_5xsoft
UpFileType = "jpg|jpeg|gif|swf"
AutoFileName = Year(Now) & "_" & Month(Now) & "_" & Day(Now) & "_" & Hour(Now) & "_" & Minute(Now) & "_" & Second(Now)

Set MyFile = MyRequest.File("File_Pic")
MyFileName = Split(MyFile.FileName,".")
MyFileExt = MyFileName(Ubound(MyFileName))

If InStr(UpFileType , MyFileExt) <= 0 Then
	ShowMsg "上传的文件的格式不正确" , ""
End If

If MyFile.FileSize < 0 Then
	ShowMsg "请选择要上传的文件" , ""
End If
If MyFile.FileSize > 1024000 Then
	ShowMsg "只能上传大小在1024K以内的文件:"& MyFile.FileSize , ""
End If

UpFileName = "Ad_Img/" & AutoFileName & "." & MyFileExt
MyFile.saveas Server.mappath("../../" & UpFileName)

Set MyFile = Nothing
Set MyRequest = Nothing
%>
<script language="javascript">
	var uppic = "<%=UpFileName%>"
	alert("文件上传成功");
	opener.PosForm.AdPicUrl.value = uppic;
	window.close();
</script>