Need to download the NeatUpload plugin
Upload page:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="" Inherits="_Default" %> <%@ Register Assembly="" Namespace="" TagPrefix="Upload" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http:///TR/xhtml1/DTD/"> <html xmlns="http:///1999/xhtml"> <head runat="server"> <title></title> <link href="easyui/themes/default/" rel="stylesheet" type="text/css" /> <link href="easyui/themes/" rel="stylesheet" type="text/css" /> <script src="easyui/" type="text/javascript"></script> <script src="easyui/" type="text/javascript"></script> </head> <body> <form 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'" onclick="BtnUP_Click">superior pass</asp:LinkButton><br /><br /> <a href="">View Download</a> </div> </form> </body> </html>
Backend source code:
protected void BtnUP_Click(object sender, EventArgs e) { if () { string FileName = ;//Get the file name of the uploaded file, including the suffix string ExtenName = (FileName);//Get the extension string SaveFileName = (("UpLoads/"), ().ToString() + "-" + FileName);//Merge two paths to the full path uploaded to the server (SaveFileName, ); string url = "UpLoads/" + ("yyyyMMddhhmmss") + ExtenName; //The path to save the file float FileSize = (float)((float) / 1024000, 1); //Get the file size and keep the decimal point one, the unit is M ("<script>alert('Congratulations, the upload was successful!')</script>"); } else { ("<script>alert('Please select the file! ')</script>"); } }
Here you directly get the upload folder file name for download
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="" Inherits="Down" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http:///TR/xhtml1/DTD/"> <html xmlns="http:///1999/xhtml"> <head runat="server"> <title></title> <link href="easyui/themes/default/" rel="stylesheet" type="text/css" /> <link href="easyui/themes/" rel="stylesheet" type="text/css" /> <script src="easyui/" type="text/javascript"></script> <script src="easyui/" 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 runat="server"> <div class="div_style easyui-panel" style="padding: 5px;"> <a href="">Upload file</a> <asp:Label ID="Label1" runat="server" Text=""></asp:Label> <ul > <%if ( == 0) { = "No file yet"; } else { foreach ( item in files) {%> <li><a href="?1=<%=item%>"> <%=item %></a> &nbsp;&nbsp; &nbsp;<a href="?1=<%=item%>" onclick="javascript:return confirm('Are you sure you delete it? ');" >Delete attachments</a> </li> <% } }%> </ul> </div> <div ></div> <%--jsPagination--%> <%--<script language="javascript"> var obj, j; var page = 0; var nowPage = 0; //Current page var listNum = 25; //Number of <ul> displayed per page var PagesLen; //Total page count var PageNum = 4; //The number of page links (5) onload = function () { obj = ("www_zzjs_net").getElementsByTagName("li"); j = PagesLen = (j / listNum); upPage(0) } function upPage(p) { nowPage = p //Content Change for (var i = 0; i < j; i++) { obj[i]. = "none" } for (var i = p * listNum; i < (p + 1) * listNum; i++) { if (obj[i]) obj[i]. = "block" } //Welcome to the webmaster special effects website. Our website is easy to remember. zz webmaster. JS is js special effects. This website collects a large amount of high-quality js codes and many advertising codes to download. //Pagination link transformation strS = '<a href="###" onclick="upPage(0)">Home</a> ' var PageNum_2 = PageNum % 2 == 0 ? (PageNum / 2) + 1 : (PageNum / 2) var PageNum_3 = PageNum % 2 == 0 ? (PageNum / 2) : (PageNum / 2) + 1 var strC = "", startPage, endPage; if (PageNum >= PagesLen) { startPage = 0; endPage = PagesLen - 1 } else if (nowPage < PageNum_2) { startPage = 0; endPage = PagesLen - 1 > PageNum ? PageNum : PagesLen - 1 } //front page else { startPage = nowPage + PageNum_3 >= PagesLen ? PagesLen - PageNum - 1 : nowPage - PageNum_2 + 1; var t = startPage + PageNum; endPage = t > PagesLen ? PagesLen - 1 : t } for (var i = startPage; i <= endPage; i++) { if (i == nowPage) strC += '<a href="###" style="color:red;font-weight:700;" onclick="upPage(' + i + ')">' + (i + 1) + '</a> ' else strC += '<a href="###" onclick="upPage(' + i + ')">' + (i + 1) + '</a> ' } //Welcome to the webmaster special effects website. Our website is easy to remember. zz webmaster. JS is js special effects. This website collects a large amount of high-quality js codes and many advertising codes to download. strE = ' <a href="###" onclick="upPage(' + (PagesLen - 1) + ')">Last Page</a> ' strE2 = nowPage + 1 + "/" + PagesLen + "Page" + " common" + j + "strip" ("changpage").innerHTML = strS + strC + strE + strE2 } </script>--%> </form> </body> </html> //The following is the background codepublic FileInfo[] files { set; get; } protected void Page_Load(object sender, EventArgs e) { string dirPath = ("~/UpLoads"); if ((dirPath)) { DirectoryInfo dir = new DirectoryInfo(dirPath); files = ("*.*"); } if ( == 0) { = "No file yet"; } } //This is the code to create another page to provide download if (["1"] != null) { string _filename = ["1"].ToString(), _filepath = (MapPath("~/UpLoads"), _filename); if ((_filepath)) { (); = true; ("Content-Disposition", "attachment;filename=" + _filename); = "application/unknow"; (_filepath); (); } } //This is to create another page to provide deletion operation (backend) string _filename = ["1"].ToString(), _filepath = (MapPath("~/UpLoads"), _filename); if ((_filepath)) { (_filepath); ("<script language=javascript>alert('Delete successfully! '); = '';</script>"); //(""); }
The above is all about this article, I hope it will be helpful to everyone's learning.