天津投入产出系统后端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

62 lines
2.4 KiB

<%@ 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" name="file" id="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="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() {
// if (document.getElementById("file").value == "") {
// MSI("提示", "请选择要上传的文件。");
// return false;
// }
// submitByButton("UploadFile");
// return true;
// }
// function submitByButton(url) {
// var thisForm = document.forms[0];
// if (url != "") {
// thisForm.action = url;
// }
// thisForm.submit();
// }
function UploadFile() {
var file = document.getElementById("file");
if (file == null || !file.value)
return alert("请选择文件");
var result = /\.[^\.]+/.exec(file.value);
if (result.toString().toUpperCase() != ".XLS" && result.toString().toUpperCase() != ".XLSX")
return alert("文件格式不正确");
submitByButton("UploadFile");
}
</script>
</body>
</html>