该代码已经使用了一年多,突然间它抛出错误消息“不支持给定路径的格式。”
filepath = "C:\\\\FaxServer\\\\InBox\\\\1820200525_0 10:34 AM.pdf"
if (!File.Exists(filePath))
{
FileStream Stream = new FileStream(filePath, FileMode.Create);
BinaryWriter BinaryStream = new BinaryWriter(Stream);
BinaryStream.Write(attachment.Body);
BinaryStream.Close();
}
提供正常的文件路径,但在字符串前使用@
。 filepath =@"C:\FaxServer\InBox\1820200525_0 10:34 AM.pdf"
应该不错。