我正在尝试从浏览器上传文件并将其复制到 URL 文件夹
使用升c。
(我拥有此文件夹的所有权限)
我没有问题将文件上传到我的硬盘
像这样:
HttpPostedFileBase myfile;
var path = Path.Combine(Server.MapPath("~/txt"), fileName);
myfile.SaveAs(path);
我尝试将它上传到这样的 URL,但我遇到了异常
HttpPostedFileBase myfile;
var path =VirtualPathUtility.ToAbsolute("http://localhost:8080/game/images/"+fileName);
myfile.SaveAs(path);
例外:
System.ArgumentException: The relative virtual path 'http:/localhost:8080/game/images/ a baby bottle. Jpg' is not allowed here.
In - System.Web.VirtualPath.Create (String virtualPath, VirtualPathOptions