需要下载NeatUpload插件

上传页面:

<%@ 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="/UploadFiles/2021-04-02/jquery.min.js">

后台源码:

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="/UploadFiles/2021-04-02/jquery.min.js">

以上就是本文的全部内容,希望对大家的学习有所帮助。

标签:
asp.net大文件上传,asp.net文件上传,asp.net上传,asp.net多文件上传

免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
白云城资源网 Copyright www.dyhadc.com

评论“ASP.NET实现大文件上传功能”

暂无“ASP.NET实现大文件上传功能”评论...

稳了!魔兽国服回归的3条重磅消息!官宣时间再确认!

昨天有一位朋友在大神群里分享,自己亚服账号被封号之后居然弹出了国服的封号信息对话框。

这里面让他访问的是一个国服的战网网址,com.cn和后面的zh都非常明白地表明这就是国服战网。

而他在复制这个网址并且进行登录之后,确实是网易的网址,也就是我们熟悉的停服之后国服发布的暴雪游戏产品运营到期开放退款的说明。这是一件比较奇怪的事情,因为以前都没有出现这样的情况,现在突然提示跳转到国服战网的网址,是不是说明了简体中文客户端已经开始进行更新了呢?