【发布时间】:2023-03-19 22:19:01
【问题描述】:
我在我的应用程序中编写了以下用于上传图像的代码。我设置了上传图像的路径。下面的代码在我的系统和公司的服务器中是正确的。但是当我发布客户网站时。在主机中找不到此路径并产生 HTTP ERROR 404.0 -NOT Found。
`string pic = System.IO.Path.GetFileNameWithoutExtension(model.ImageUpload.FileName) + Guid.NewGuid() + System.IO.Path.GetExtension(model.ImageUpload.FileName);
string path = System.IO.Path.Combine(
Server.MapPath("~"), "Areas/Administrator/uploads/", pic);
string PicPath = System.IO.Path.Combine("/Areas/Administrator/uploads", pic);
PicPath = PicPath.Replace("\\", "/");
model.ImageUpload.SaveAs(path);
bImageUpload.Inser(new Shared.Entities.SMP.ImageUpload
{
Title = model.Titel,
Lang = CultureHelper.GetLangFromCulture(),
ImageUrl = PicPath
});`
【问题讨论】:
标签: asp.net-mvc html web-services asp.net-mvc-3 iis