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

<!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>
</head>
<base target="_self"> 
<body  style="margin: 0px">
    <div>
            <%using (Html.BeginForm("ImageUplod", "Image", FormMethod.Post, new { enctype = "multipart/form-data" }))
              {%>           
            <table align="center" style="top: 15px; position: relative;">
                <tr>
                    <th nowrap=nowrap>请选择文件</th>
                    <td><input type="file" id="file" name="file" /></td>
                </tr>
                <tr>
                    <td>&nbsp;&nbsp;</td>
                    <td>&nbsp;&nbsp;</td>
                </tr>
                <tr>
                    <td align="center" colspan=2>
                        <a IconCls="icon-ok" class="easyui-linkbutton" href="#" onclick="ImageUplod();" plain="false">确定</a>
                        <a IconCls="icon-no" class="easyui-linkbutton" href="#" onclick="window.close();return false;" plain="false">取消</a>                       
                    </td>
                </tr>
            </table>
        <% }%>
    </div>

        <%Html.RenderPartial("../Shared/Scripts"); %>
    <script language="javascript" type="text/javascript">
        //上传文件
        function ImageUplod() {
            var var1 = document.getElementById("file").value;
            if (var1=="") {
                return alert("请选择文件");
            }
            var type = (/\.[^\.]+$/.exec(var1)).toString();
            if (type != ".bmp" && type != ".jpg" && type != ".png" && type != ".JPG" && type != ".BMP" && type != ".PNG")
            {
                return alert("文件格式不正确");
            }
            submitByButton("ImageUplod");
            return true;
        }
    </script> 
</body>
</html>