2011-02-07 5 views
1

다음 코드를 참조하십시오. 파일을 업로드하는 중이지만 다른 브라우저와는 다른 결과가 나타납니다.HttpPostedFileBase를 사용하여 다른 경로 가져 오기

파이어 폭스 VAR 경로 = "about.restaurant.jpg"6으로 경로에 아직

= "D : \ dev에 \ xxxxx는 \ xxxxx는 \ xxxxx는 \ 웹 사이트 \ 이미지 \ about.restaurant.jpg"

foreach (string file in Request.Files) 
{ 
     var hpf = Request.Files[file] as HttpPostedFileBase; 
     var path = hpf.FileName; 
} 

MVC2에서이 문제가 발생했습니다. MVC3으로 업그레이드되었습니다. 같은 문제가 있습니다.

<form action="/Product/SaveUploadImage" method="post" enctype="multipart/form-data"> 
<input type="file" name="file" id="file" /> 
<input type="submit" value="Save" class="button" /> 
</form> 

답변

5

아하. 그래서이 모든 것을 해결하는 방법이 있습니다.

Path.GetFileName (hpf.FileName)

관련 문제