<%@ Page Language="C#" AutoEventWireup="true" CodeFile="BorrowPage.aspx.cs" Inherits="Borrow_BorrowPage" %>
<!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>xxx上传</title>
<script type="text/javascript">
function checkFile()
{
//判断浏览器类型
var isIE = (document.all) ? true : false;
var isIE7 = isIE && (navigator.userAgent.indexOf('MSIE 7.0') != -1);
var isIE8 = isIE && (navigator.userAgent.indexOf('MSIE 8.0') != -1);
var file=document.getElementById("UpLoadBorrow");
var path=file.value;
if(isIE7 || isIE8)
{
file.select();
path=document.selection.createRange().text;
document.selection.empty();
}
document.getElementById("txtFilePath").value=path;
}
function checkNull()
{
var path=document.getElementById("txtFilePath").value;
if(path=="" ||path==null)
{
alert('请选择要上传的文件!');
return false;
}
return true;
}
</script>
<base target="_self"/>
</head>
<body style="">
<form id="form1" runat="server">
<div style="margin:0px auto 0px auto;">
<asp:Image ID="Image1" runat="server" BorderStyle="Double" Width="750" ImageAlign="Middle" AlternateText="上传"/>
<br />
上传:<asp:FileUpload ID="UpLoadBorrow" runat="server" Height="22px" onchange="checkFile()" onkeydown="event.returnValue=false;" onpaste="return false" />
<input type="hidden" id="txtFilePath" runat="server" />//这里建立一个隐藏域 用来存地址
<asp:Button ID="btnUpload" runat="server" Text="上传" OnClientClick="return checkNull()" OnClick="btnUpLoad_Click" />
<asp:Button ID="btnBack" runat="server" Text="返回" onmousedown="window.close();" /></div>
</form>
</body>
</html>