gpt4 book ai didi

c# - "The given path' 格式不受支持。”

转载 作者:IT王子 更新时间:2023-10-29 03:36:44 28 4
gpt4 key购买 nike

我的网络服务中有以下代码:

string str_uploadpath = Server.MapPath("/UploadBucket/Raw/");
FileStream objfilestream = new FileStream(str_uploadpath +
fileName, FileMode.Create, FileAccess.ReadWrite);

谁能帮我解决代码第 2 行的错误消息的问题。

The given path's format is not supported.

该文件夹的权限设置为所有人都可以完全访问,这是该文件夹的实际路径。

断点为我提供了 str_uploadpath 的值作为 C:\\webprojects\\webservices\\UploadBucket\\Raw\\

这个字符串有什么问题?

最佳答案

与其使用 str_uploadpath + fileName,不如尝试使用 System.IO.Path.Combine相反:

Path.Combine(str_uploadpath, fileName);

它返回一个字符串。

关于c# - "The given path' 格式不受支持。”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7348768/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com