Need to download Neatupload plugin
Upload page:
<%@ Page language= "C #" autoeventwireup= "true" codefile= "Index.aspx.cs" inherits= "_default"%> <%@ Register Ass Embly= "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 ">
Background Source:
protected void Btnup_click (object sender, EventArgs e)
{
if (attachfile.hasfile)
{
string FileName = This. attachfile.filename;//gets the file name of the uploaded file, including the suffix
string extenname = System.IO.Path.GetExtension (FileName);//Get extension
String savefilename = System.IO.Path.Combine (System.Web.HttpContext.Current.Request.MapPath ("uploads/"), DateTime.Now.ToLongDateString (). ToString () + "-" + FileName),//merge two paths to the full path Attachfile.moveto on the server
(Savefilename, Brettle.Web.NeatUpload.MoveToOptions.Overwrite);
String url = "uploads/" + DateTime.Now.ToString ("Yyyymmddhhmmss") + extenname; File save path
float FileSize = (float) System.Math.Round ((float) attachfile.contentlength/1024000, 1); Get the file size and keep one after the decimal point, the unit is m
Response.Write ("<script>alert" (' Congratulations, upload success! ') </script> ");
}
else
{
Response.Write (' <script>alert (' Please select File! ') </script> ");
}
Here directly get upload folder file name provide download
<%@ 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 ">
The above is the entire content of this article, I hope to help you learn.