2012-05-02 3 views
0

JQuery를 사용하여 웹 사이트 페이지의 파일 업로드 대화 상자를 통해 내 웹 사이트의 루트 폴더에있는 폴더로 파일을 업로드하고 있습니다. 이것은 Casinni를 사용하여 로컬에서 실행할 때 제대로 작동하지만 IIS 7을 사용하여 사이트를 호스팅하는 서버에 배포 할 때 실패합니다. 이러한 파일 업로드를 허용하려면 IIS에서 어떤 작업을 수행해야합니까? 이 라인을 따라.NET에서 파일 업로드를 허용하는 방법

+2

파일 사용 권한을 확인하셨습니까? 또한 우리에게 오류를 보내십시오. – Zaki

+1

작업자 프로세스는 어떤 역할을 수행합니까? 로컬 드라이브에 쓰기 권한이 있습니까? –

답변

0

뭔가 ...이 "기술"http://msdn.microsoft.com/en-us/library/aa479405.aspx

이 .... 잊어 버려 전체를 오해를 획득

<%@ Page Language="C#" %> 

<script runat="server"> 
    protected void Button1_Click(object sender, EventArgs e) 
    { 
     if (FileUpload1.HasFile) 
      try 
      { 
      FileUpload1.SaveAs("C:\\Uploads\\" + 
       FileUpload1.FileName); 
      Label1.Text = "File name: " + 
       FileUpload1.PostedFile.FileName + "<br>" + 
       FileUpload1.PostedFile.ContentLength + " kb<br>" + 
       "Content type: " + 
       FileUpload1.PostedFile.ContentType; 
     } 
     catch (Exception ex) 
     { 
      Label1.Text = "ERROR: " + ex.Message.ToString(); 
     } 
    else 
    { 
     Label1.Text = "You have not specified a file."; 
    } 
    } 
</script> 

<html xmlns="http://www.w3.org/1999/xhtml" > 
<head runat="server"> 
    <title>Upload Files</title> 
</head> 
<body> 
    <form id="form1" runat="server"> 
     <div> 
     <asp:FileUpload ID="FileUpload1" runat="server" /><br /> 
     <br /> 
     <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" 
     Text="Upload File" />&nbsp;<br /> 
     <br /> 
     <asp:Label ID="Label1" runat="server"></asp:Label></div> 
    </form> 
</body> 
</html> 

또 다른 소스.

관련 문제