问个路径问题!在线等 我想在网站目录下建一个文件夹,具体来说就是通过后台类在webRoot下建一个文件夹,用于存储文件,在程序中如何实现。是不是用到相对路径问题。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 Directory.Create(Server.MapPath("../YourFolderName")); //bin的上级目录下创建。 string savePath = Server.MapPath("~/upload/"); if (!System.IO.Directory.Exists(savePath)) { System.IO.Directory.CreateDirectory(savePath); } 弱弱的问一下,你发布的WebSite,Bin在哪一级目录下? 如果你用的是sturts 那么项目路径就是request.getSession().getContext().getRealPath("/"); 当然我指的是用ssh集成的时候。 在网站下的任何一个网页,打入以下代码,就会在跟目录下创建一个文件夹: string sPath = Server.MapPath("~/你的文件夹名/"); if (!System.IO.Directory.Exists(sPath)) { System.IO.Directory.CreateDirectory(sPath); } 怎么查不到?msdn上http://msdn.microsoft.com/zh-cn/library/54a0at6s.aspx 所有的文件、文件夹操作都在这下面http://msdn.microsoft.com/zh-cn/library/system.io.aspx IO 操作http://msdn.microsoft.com/zh-cn/library/system.io.directory(VS.80).aspx string savePath = Server.MapPath("~/"); if (!System.IO.Directory.Exists(savePath)) { System.IO.Directory.CreateDirectory(savePath); } 奇怪的问题(读取数据问题) 在线等 [急,站等!]framework 4.0 下怎么设置web.config才能使用unsafe gridview怎么分页啊? 在GIRDVIEW的表格上点击右键,出现一个弹出的菜单 浏览器问题(IE) reader读取数据问题 在sql server中如何添加一个表以及给表添加列? div和lable位置问题 这段代码的意思? 哪里有校友录下载啊!ASP的 如何释放程序占用的内存? 怎么让时间动,不刷新的情况下
if (!System.IO.Directory.Exists(savePath))
{
System.IO.Directory.CreateDirectory(savePath);
}
string sPath = Server.MapPath("~/你的文件夹名/");
if (!System.IO.Directory.Exists(sPath))
{
System.IO.Directory.CreateDirectory(sPath);
}
http://msdn.microsoft.com/zh-cn/library/system.io.aspx
http://msdn.microsoft.com/zh-cn/library/system.io.directory(VS.80).aspx
if (!System.IO.Directory.Exists(savePath))
{
System.IO.Directory.CreateDirectory(savePath);
}