<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
	<title>上传图片</title>
	<script src="../../Scripts/jquery-1.3.2.min.js" type="text/javascript"></script>
	<script src="../../Scripts/Admin.js" type="text/javascript"></script>
	<script type="text/javascript">
		$(function () {
			var oldFileName = '<%=Request.QueryString["filename"] %>';
			var oldFileExt = oldFileName.substring(oldFileName.lastIndexOf(".")).toLowerCase();
			var newFile = $("#QuickReplaceImageUploadFile");
			$("#form").submit(function () {
				var newFileExt = newFile.val().substring(newFile.val().lastIndexOf(".")).toLowerCase();
				if (oldFileExt != newFileExt) {
					ShowMsg("新图片必须为 " + oldFileExt + " 格式。");
					return false;
				}
				return true;
			});
		});
		function CopyPath() {
			var win = window.opener;
			var str = location.toString();
			var Result = str.split("filename=")[1];
			win.RefreshImg();
			win = null;
			window.close();
			return;
		}
		<%if (TempData["Result"]!=null) {%>
		CopyPath();
		<%} %>
	</script>
</head>
<body>
	<form method="post" id="form" accept="<%=Url.Action("QuickReplaceImageUpload")%>">
	<%=Html.TextBoxFileUrl("/Content/fckeditor/","Image","QuickReplaceImageUploadFile","",null) %>
	<input type="hidden" name="filename" value="<%=Request.QueryString["filename"] %>" />
	<input type="submit" id="submit" value="确定替换" />
	</form>
</body>
</html>
