2012-04-09 4 views
1

로컬 드라이브에서 파일을 업로드하는 동안 다음 오류가 발생합니다.주어진 경로 형식이 지원되지 않습니다.

주어진 경로의 형식은 지원되지 않습니다.

코드가 주어집니다. 내가해야하는 변경 사항을 알려주십시오.

string file0 = MapPathReverse(FileUpload1.PostedFile.FileName);// Get virtual path 
    string conversationFileSource = Server.MapPath(file0); 
    StreamReader file = new StreamReader(conversationFileSource); 
+0

은 무엇인가 'MapPathReverse()'함수는 어떻게됩니까? 코드를 게시 할 수 있습니까? – gideon

+1

무엇을하려고합니까? –

+0

MapPathReverse는 가상 경로를 가져 오는 방법입니다. – Shami

답변

0

당신이 업로드 된 파일의 입력 스트림에 액세스하려면 : 당신은 당신의 서버에서 일부 폴더에 업로드 된 파일을 저장하려면

using (StreamReader reader = new StreamReader(FileUpload1.PostedFile.InputStream)) 
{ 
    ... 
} 

가 :

var uploadsFolder = Server.MapPath("~/uploads"); 
var file = Path.Combine(uploadsFolder, Path.GetFileName(FileUpload1.PostedFile.FileName)); 
FileUpload1.PostedFile.SaveAs(file); 
관련 문제