내가 업로드하고있어 이미지 :자원을 찾을 수없는 이유는
<img height="100px" src="/Content/Uploads/Thumb/833c4384-884d-4250-982c-d5df0fa875ef.jpg" width="100px"/>
하지만 돈 :
[HttpPost]
public ActionResult Create(PlaceViewModel model)
{
if (ModelState.IsValid)
{
string fileName = Guid.NewGuid().ToString() + ".jpg";
string serverPath = Server.MapPath("~");
string imagesPath = serverPath + "Content\\Uploads\\";
string thumbPath = imagesPath + "Thumb\\";
string fullPath = imagesPath + "Full\\";
ImageModel.ResizeAndSave(thumbPath, fileName, model.ImageUploaded.InputStream, 100, true);
ImageModel.ResizeAndSave(fullPath, fileName, model.ImageUploaded.InputStream, 600, true);
model.Image = fileName;
var place = new Place();
model.ConvertToData(place);
_placeRepository.Add(place);
_placeRepository.SaveChanges();
return RedirectToAction("Index");
}
return View(model);
}
파일 업로드 및
나는 HTML에서 이미지를 호출하고있어 디스크에 물리적 존재 이 이미지가 보이지 않습니다. 내가 localhost:23354/Content/Uploads/Thumb/833c4384-884d-4250-982c-d5df0fa875ef.jpg
를 호출하면
내가 가진 오류 : 내가 잘못
The resource cannot be found. Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.
Requested URL: /Content/Uploads/Thumb/833c4384-884d-4250-982c-d5df0fa875ef.jpg
을 뭐하는 거지?
이 URL의 루트에있는 내용입니다 filename.jpg.jpeg 것을 밝혀 '.JPG'이름 확장명을 추가?/content에서 이미지를 요청했지만 업로드했을 때 ~/content /에 업로드했습니다 ... 같은 위치입니까? – Brettski
왜이 질문에 두 차례 투표가 있습니까? – Brettski
Brettski에 동의합니다. 그것은 아주 유효한 질문입니다. +1. –