Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/329.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 将图像上载到其他服务器上的特定URL,同时将图像保存在DB中_C#_Image - Fatal编程技术网

C# 将图像上载到其他服务器上的特定URL,同时将图像保存在DB中

C# 将图像上载到其他服务器上的特定URL,同时将图像保存在DB中,c#,image,C#,Image,我想将图像上传到一个特定的URL,同时用C语言将图像保存在DB中 例如,我想将图像上传到localhost:5436/nik/potrait,并想将它要保存的文件路径也从c保存到DB中 我使用此代码保存图像 image.Save(System.Web.HttpContext.Current.Server.MapPath(PortraitFileName), System.Drawing.Imaging.ImageFormat.Jpeg); 但它需要虚拟路径而不是物理路径。

我想将图像上传到一个特定的URL,同时用C语言将图像保存在DB中

例如,我想将图像上传到localhost:5436/nik/potrait,并想将它要保存的文件路径也从c保存到DB中

我使用此代码保存图像

image.Save(System.Web.HttpContext.Current.Server.MapPath(PortraitFileName),
           System.Drawing.Imaging.ImageFormat.Jpeg);

但它需要虚拟路径而不是物理路径。任何人都能帮上忙。

如果您想使用绝对路径,只需删除映射路径即可。我尝试了,但给出的错误是基础提供程序未能打开。我猜您的IIS或任何应用程序池都不会在对该文件夹具有写访问权限的用户下运行