<%@ 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("UploadFile","File",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> </td> <td> </td> </tr> <tr> <td align="center" colspan=2> <a IconCls="icon-ok" class="easyui-linkbutton" href="#" onclick="UploadFile();" 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 UploadFile() { var var1 = document.getElementById("file").value; var d = /\.[^\.]+$/.exec(var1); if ( var1== "") { MSI("提示", "请选择要上传的文件。"); return false; } if (d != ".xls") { MSI("提示", "请选择正确的导入文件。"); return false; } submitByButton("UploadFile"); return true; } </script> </body> </html>