日期:2014-05-18  浏览次数:20441 次

asp.net 获取文件目录 !!!~~~超急等待~~~~在线...
我想在aspx页面获取文件的目录,FileUpload控件只能取到具体文件
 我关注的只是目录,选择文件夹后得到该文件夹的绝对路径,请问各位怎么实现阿
C#脚本的,

------解决方案--------------------
Path.GetDirectoryName
返回文件路径的目录信息
Path.GetFullPath
返回完整路径
------解决方案--------------------
用楼上的方法!逐个文件上传!
------解决方案--------------------
lz的意思大概是要做安装\设置程序,这个用js实现吧? 

.net都是运行在后台的怎么抓取客户端的目录
------解决方案--------------------
Request.PhysicalPath
------解决方案--------------------
[code=C#][/code]
 string Path = Server.MapPath("路径");
FileInfo fi = new FileInfo(Path);
DirectoryInfo df = fi.Directory;
FileSystemInfo[] fsi = df.GetFiles();
------解决方案--------------------
<script language="C#" runat="server">
public void UploadFile(object sender, EventArgs E)
{
if (FileUpload1.PostedFile != null)
{
string nam = FileUpload1.PostedFile.FileName;
int i = nam.LastIndexOf(".");
int j = nam.LastIndexOf("\\");
string newsss = nam.Substring(j);
string newext = nam.Substring(i);
DateTime now = DateTime.Now;
string newname = now.DayOfYear.ToString() + FileUpload1.PostedFile.ContentLength.ToString();
//FileUpload1.PostedFile.SaveAs(Server.MapPath("text" + newname + newext));
FileUpload1.PostedFile.SaveAs("D:\\Nwingtech\\check\\" + newsss);
}
}
</script>