asp.net上传execl文件后,在页面上加载显示(示例代码(2)

string filename = "";
        if (nametype == 1)
        {
            string nowdate = DateTime.Now.ToString();
            nowdate = nowdate.Replace(":", "").Replace(" ", "").Replace("-", "").Trim();
            Random r = new Random();
            int a = r.Next(1000);
            filename = nowdate + a.ToString() + Type;
            newFileName = filename;
        }
        else
        {
            filename = fu.FileName;
            if (System.IO.File.Exists(path + filename)) { erorr = "此文件名已经存在!"; return erorr; }
        }

fu.SaveAs(path + filename);
        return erorr;//返回有错的错误信息,没有错误返回null
    }
    #endregion

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wjzswd.html