【发布时间】:2024-05-18 15:05:02
【问题描述】:
我在我的 Web 应用程序中使用 FileUploader 控件。我想将文件上传到指定的文件夹中。由于具体的文件夹还不存在,我必须在我的代码中创建它的路径。
Could not find part of the path.
mscorlib.dll but was not handled in user code
Additional information: Could not find a part of the path
'C:\Users\seldarine\Desktop\PROJ\ED_Project\SFiles\Submissions\blueteam\Source.zip
我认为我的文件路径有问题。 这是我的代码的一部分:
//teamName is a string passed from a session object upon login
string filePath = "SFiles/Submissions/" + teamName+ "/";
//If directory does not exist
if (!Directory.Exists(filePath))
{ // if it doesn't exist, create
System.IO.Directory.CreateDirectory(filePath);
}
f_sourceCode.SaveAs(Server.MapPath(filePath + src));
f_poster.SaveAs(Server.MapPath(filePath + bb));
【问题讨论】:
标签: c# asp.net file file-upload directory