C# 将图像保存到位于wwwroot中的文件夹

C# 将图像保存到位于wwwroot中的文件夹,c#,visual-studio,asp.net-core,C#,Visual Studio,Asp.net Core,我在wwwroot文件夹中有一个名为Images的文件夹。我想将我的图像保存到该文件夹中。现在图像保存在wwwroot文件夹(外部图像)中,保存的图像的名称以图像开头。以下是我正在使用的代码: string filepath = Path.Combine(_caminho.WebRootPath, "Images" + name); “name”是一个具有图像名称的字符串。为什么会发生这种情况?您似乎在将字符串“Images”连接到name。我建议你这样做 (...&q

我在wwwroot文件夹中有一个名为Images的文件夹。我想将我的图像保存到该文件夹中。现在图像保存在wwwroot文件夹(外部图像)中,保存的图像的名称以图像开头。以下是我正在使用的代码:

  string filepath = Path.Combine(_caminho.WebRootPath, "Images" + name);

“name”是一个具有图像名称的字符串。为什么会发生这种情况?

您似乎在将字符串
“Images”
连接到
name
。我建议你这样做

(..."Images", name);
看起来名字前面加了“图像”。在没有看到更多代码的情况下,我不得不假设您应该这样做:
stringfilepath=Path.Combine(_caminho.WebRootPath,“Images”,name)