C# 根据时间创建文件夹
2015-06-01 17:10
295 查看
string file = ((fileNameIndex)index).ToString(); if (!Directory.Exists(HttpContext.Current.Server.MapPath("~/admin/upload/") + ((fileNameIndex)index).ToString())) Directory.Exists(HttpContext.Current.Server.MapPath("~/admin/upload/") + ((fileNameIndex)index).ToString()); if (!Directory.Exists(HttpContext.Current.Server.MapPath("~/admin/upload/") + file + "/" + DateTime.Now.ToString("yyyy"))) Directory.CreateDirectory(HttpContext.Current.Server.MapPath("~/admin/upload/") + file + "/" + DateTime.Now.ToString("yyyy")); if (!Directory.Exists(HttpContext.Current.Server.MapPath("~/admin/admin/upload/" + file + "/" + DateTime.Now.ToString("yyyy/MM")))) Directory.CreateDirectory(HttpContext.Current.Server.MapPath("~/admin/upload/" + file + "/" + DateTime.Now.ToString("yyyy/MM"))); if (!Directory.Exists(HttpContext.Current.Server.MapPath("~/admin/upload/" + file + "/" + DateTime.Now.ToString("yyyy/MM/dd")))) Directory.CreateDirectory(HttpContext.Current.Server.MapPath("~/admin/upload/" + file + "/" + DateTime.Now.ToString("yyyy/MM/dd"))); if (!Directory.Exists(HttpContext.Current.Server.MapPath("~/admin/upload/" + file + "/" + DateTime.Now.ToString("yyyy/MM/dd")))) Directory.CreateDirectory(HttpContext.Current.Server.MapPath("~/admin/upload/" + file + "/" + DateTime.Now.ToString("yyyy/MM/dd"))); imgsrc = HttpContext.Current.Server.MapPath("~/admin/upload/" + file + "/" + DateTime.Now.ToString("yyyy/MM/dd/") + img); imgsrc = "/admin/upload/" + file + "/" + DateTime.Now.ToString("yyyy/MM/dd/") + img;
相关文章推荐
- C# Rows.Remove() 和 DataRow.Delete() 的区别
- C#:代表(delegate)和事件(event) (转)
- C# DataAdapter.Update() 无法更新数据表中删除的数据行
- 通过configSource提高web.config配置灵活性
- mongo DB for C#
- c#的DateTime.Now函数详解
- C# 中引用dll类库时 “不可访问,因为它受保护级别限制”
- c# 调用打印机
- 找出C#代码中未使用的变量和函数
- C#泛型约束
- Illustrated C#2012--第一章节--C#和.NET Framework--进入Microsoft .NET
- c#中的resx文件出现未能找到具有某个名称的类型
- C#使用System.Environment操作系统环境变量的中文API
- C#6.0 VS2015
- 终于会用c#中的delegate(委托)和event(事件)了 [转]
- C#获取本机IP搜集整理7种方法
- C#中Split用法~
- C#--Web邮箱删除信件效果
- 利用C#进行AUTOCAD的二次开发
- C#中String.Empty,“”,NULL的区别