【发布时间】:2012-04-21 15:05:30
【问题描述】:
从本地驱动器上传文件时出现以下错误。
不支持给定路径的格式。
代码已给出。 请告诉我我必须做出哪些改变。
string file0 = MapPathReverse(FileUpload1.PostedFile.FileName);// Get virtual path
string conversationFileSource = Server.MapPath(file0);
StreamReader file = new StreamReader(conversationFileSource);
【问题讨论】:
-
MapPathReverse()函数在做什么?你能发布它的代码吗? -
MapPathReverse 是一种获取虚拟路径的方法。
-
公共静态字符串 MapPathReverse(string fullServerPath) { return @"~\" + fullServerPath.Replace(HttpContext.Current.Request.PhysicalApplicationPath, String.Empty); }
-
我想上传一个文件并使用其完整路径来访问该文件。我需要它的完整路径,以便我可以读取该文件并继续。
标签: asp.net file-upload