%@ Page Language="C#" AutoEventWireup="true" CodeFile="index.aspx.cs" Inherits="_Default" %>
%@ Register Assembly="Brettle.Web.NeatUpload" Namespace="Brettle.Web.NeatUpload"
TagPrefix="Upload" %>
!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>
link href="easyui/themes/default/easyui.css" rel="stylesheet" type="text/css" />
link href="easyui/themes/icon.css" rel="stylesheet" type="text/css" />
script src="easyui/jquery.min.js" type="text/javascript">/script>
script src="easyui/jquery.easyui.min.js" type="text/javascript">/script>
/head>
body>
form id="form1" runat="server">
div class="easyui-panel" style="padding:5px;">
Upload:ProgressBar ID="ProgressBar1" runat='server'>
/Upload:ProgressBar>
br />
Upload:InputFile ID="AttachFile" runat="server" />
br />
br />
asp:LinkButton ID="BtnUP" runat="server" class="easyui-linkbutton" data-options="iconCls:'icon-add'" >查看下载/a>
/div>
/form>
/body>
/html>
protected void BtnUP_Click(object sender, EventArgs e)
{
if (AttachFile.HasFile)
{
string FileName = this.AttachFile.FileName;//获取上传文件的文件名,包括后缀
string ExtenName = System.IO.Path.GetExtension(FileName);//获取扩展名
string SaveFileName = System.IO.Path.Combine(System.Web.HttpContext.Current.Request.MapPath("UpLoads/"), DateTime.Now.ToLongDateString().ToString() + "-" + FileName);//合并两个路径为上传到服务器上的全路径
AttachFile.MoveTo(SaveFileName, Brettle.Web.NeatUpload.MoveToOptions.Overwrite);
string url = "UpLoads/" + DateTime.Now.ToString("yyyyMMddhhmmss") + ExtenName; //文件保存的路径
float FileSize = (float)System.Math.Round((float)AttachFile.ContentLength / 1024000, 1); //获取文件大小并保留小数点后一位,单位是M
Response.Write("script>alert('恭喜您,上传成功!')/script>");
}
else
{
Response.Write("script>alert('请选择文件!')/script>");
}
}
%@ Page Language="C#" AutoEventWireup="true" CodeFile="Down.aspx.cs" Inherits="Down" %>
!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>
link href="easyui/themes/default/easyui.css" rel="stylesheet" type="text/css" />
link href="easyui/themes/icon.css" rel="stylesheet" type="text/css" />
script src="easyui/jquery.min.js" type="text/javascript">/script>
script src="easyui/jquery.easyui.min.js" type="text/javascript">/script>
style type="text/css">
.div_style ul li
{
list-style-type: decimal;
border-bottom:1px dashed #E3E3E3;
margin-bottom:5px;
}
.div_style ul li a
{
text-decoration: none;
cursor: pointer;
font-size: 16px;
}
/style>
/head>
body>
form id="form1" runat="server">
div class="div_style easyui-panel" style="padding: 5px;">
a href="index.aspx">上传文件/a>
asp:Label ID="Label1" runat="server" Text="">/asp:Label>
ul id="www_zzjs_net">
%if (files.Length == 0) { Label1.Text = "暂无文件"; }
else
{
foreach (System.IO.FileInfo item in files)
{%>
li>a href="Default2.aspx?1=%=item%>">
%=item %>/a> nbsp;nbsp; nbsp;a href="delete.aspx?1=%=item%>" );
}