FileUpload 클래스

정의

사용자가 서버에 업로드할 파일을 선택하는 데 사용할 수 있는 TextBox 컨트롤과 찾아보기 단추를 표시합니다.

public ref class FileUpload : System::Web::UI::WebControls::WebControl
[System.Web.UI.ControlValueProperty("FileBytes")]
[System.Web.UI.ValidationProperty("FileName")]
public class FileUpload : System.Web.UI.WebControls.WebControl
[<System.Web.UI.ControlValueProperty("FileBytes")>]
[<System.Web.UI.ValidationProperty("FileName")>]
type FileUpload = class
    inherit WebControl
Public Class FileUpload
Inherits WebControl
상속
특성

예제

소스 코드를 사용 하 여 Visual Studio 웹 사이트 프로젝트는 다음이 항목과 함께 사용할 수 있습니다: 다운로드합니다.

이 섹션에 다음 네 가지 예제가 있습니다.

  • 첫 번째 예제를 만드는 방법을 보여는 FileUpload 코드에 지정 된 경로에 파일을 저장 하는 컨트롤입니다.

  • 두 번째 예제를 만드는 방법을 보여 줍니다는 FileUpload 애플리케이션에 대 한 파일 시스템에서 지정된 된 디렉터리에 파일을 저장 하는 컨트롤입니다.

  • 세 번째 예제를 만드는 방법을 보여는 FileUpload 지정된 된 경로에 파일을 저장 하 고 업로드할 수 있는 파일의 크기를 제한 하는 컨트롤입니다.

  • 네 번째 예제를 만드는 방법을 보여는 FileUpload 지정된 된 경로에 파일을 저장 하 고 업로드할.xls 또는.doc 파일 이름 확장명을 가진 파일만 허용 하는 컨트롤입니다.

주의

이러한 예제에 대 한 기본 구문을 보여 주기는 FileUpload 제어 하지만 보여주지 않습니다 모든 필요한 오류 검사 파일을 저장 하기 전에 완료 해야 하는 합니다. 자세한 예제는 SaveAs를 참조하십시오.

다음 예제에서는 만드는 방법을 보여 줍니다는 FileUpload 코드에 지정 된 경로에 파일을 저장 하는 컨트롤입니다. SaveAs 메서드를 호출 하는 서버에서 지정된 된 경로에 파일을 저장 합니다.

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

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 

<script runat="server">

  protected void UploadButton_Click(object sender, EventArgs e)
  {
    // Specify the path on the server to
    // save the uploaded file to.
    String savePath = @"c:\temp\uploads\";
 
    // Before attempting to perform operations
    // on the file, verify that the FileUpload 
    // control contains a file.
    if (FileUpload1.HasFile)
    {
      // Get the name of the file to upload.
      String fileName = FileUpload1.FileName;
      
      // Append the name of the file to upload to the path.
      savePath += fileName;
      

      // Call the SaveAs method to save the 
      // uploaded file to the specified path.
      // This example does not perform all
      // the necessary error checking.               
      // If a file with the same name
      // already exists in the specified path,  
      // the uploaded file overwrites it.
      FileUpload1.SaveAs(savePath);
      
      // Notify the user of the name of the file
      // was saved under.
      UploadStatusLabel.Text = "Your file was saved as " + fileName;
    }
    else
    {      
      // Notify the user that a file was not uploaded.
      UploadStatusLabel.Text = "You did not specify a file to upload.";
    }

  }
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>FileUpload Example</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
       <h4>Select a file to upload:</h4>
   
       <asp:FileUpload id="FileUpload1"                 
           runat="server">
       </asp:FileUpload>
            
       <br /><br />
       
       <asp:Button id="UploadButton" 
           Text="Upload file"
           OnClick="UploadButton_Click"
           runat="server">
       </asp:Button>    
       
       <hr />
       
       <asp:Label id="UploadStatusLabel"
           runat="server">
       </asp:Label>        
    </div>
    </form>
</body>
</html>
<%@ Page Language="VB" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 

<script runat="server">
        
  Sub UploadButton_Click(ByVal sender As Object, ByVal e As System.EventArgs)
            
    ' Specify the path on the server to
    ' save the uploaded file to.
    Dim savePath As String = "c:\temp\uploads\"
            
    ' Before attempting to perform operations
    ' on the file, verify that the FileUpload 
    ' control contains a file.
    If (FileUpload1.HasFile) Then
      ' Get the name of the file to upload.
      Dim fileName As String = FileUpload1.FileName
                      
      ' Append the name of the file to upload to the path.
      savePath += fileName
                
      ' Call the SaveAs method to save the 
      ' uploaded file to the specified path.
      ' This example does not perform all
      ' the necessary error checking.               
      ' If a file with the same name
      ' already exists in the specified path,  
      ' the uploaded file overwrites it.
      FileUpload1.SaveAs(savePath)
                
      ' Notify the user of the name the file
      ' was saved under.
      UploadStatusLabel.Text = "Your file was saved as " & fileName
                
    Else
      ' Notify the user that a file was not uploaded.
      UploadStatusLabel.Text = "You did not specify a file to upload."
    End If

  End Sub
       
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>FileUpload Example</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
       <h4>Select a file to upload:</h4>
   
       <asp:FileUpload id="FileUpload1"                 
           runat="server">
       </asp:FileUpload>
            
       <br /><br />
       
       <asp:Button id="UploadButton" 
           Text="Upload file"
           OnClick="UploadButton_Click"
           runat="server">
       </asp:Button>    
       
       <hr />
       
       <asp:Label id="UploadStatusLabel"
           runat="server">
       </asp:Label>        
    </div>
    </form>
</body>
</html>

다음 예제에서는 만드는 방법을 보여 줍니다는 FileUpload 애플리케이션에 대 한 파일 시스템에서 지정된 된 디렉터리에 파일을 저장 하는 컨트롤입니다. HttpRequest.PhysicalApplicationPath 속성은 현재 실행 중인 서버 애플리케이션에 대 한 루트 디렉터리의 실제 파일 시스템 경로 가져오는 데 사용 됩니다. SaveAs 메서드를 호출 하는 서버에서 지정된 된 경로에 파일을 저장 합니다.

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

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

    protected void UploadButton_Click(object sender, EventArgs e)
    {
        // Save the uploaded file to an "Uploads" directory
        // that already exists in the file system of the 
        // currently executing ASP.NET application.  
        // Creating an "Uploads" directory isolates uploaded 
        // files in a separate directory. This helps prevent
        // users from overwriting existing application files by
        // uploading files with names like "Web.config".
        string saveDir = @"\Uploads\";

        // Get the physical file system path for the currently
        // executing application.
        string appPath = Request.PhysicalApplicationPath;

        // Before attempting to save the file, verify
        // that the FileUpload control contains a file.
        if (FileUpload1.HasFile)
        {
            string savePath = appPath + saveDir +
                Server.HtmlEncode(FileUpload1.FileName);
            
            // Call the SaveAs method to save the 
            // uploaded file to the specified path.
            // This example does not perform all
            // the necessary error checking.               
            // If a file with the same name
            // already exists in the specified path,  
            // the uploaded file overwrites it.
            FileUpload1.SaveAs(savePath);

            // Notify the user that the file was uploaded successfully.
            UploadStatusLabel.Text = "Your file was uploaded successfully.";

        }
        else
        {
            // Notify the user that a file was not uploaded.
            UploadStatusLabel.Text = "You did not specify a file to upload.";   
        }
    }
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>FileUpload Class Example</title>
</head>
<body>
    <h3>FileUpload Class Example: Save To Application Directory</h3>
    <form id="form1" runat="server">
    <div>
       <h4>Select a file to upload:</h4>
   
       <asp:FileUpload id="FileUpload1"                 
           runat="server">
       </asp:FileUpload>
            
       <br/><br/>
       
       <asp:Button id="UploadButton" 
           Text="Upload file"
           OnClick="UploadButton_Click"
           runat="server">
       </asp:Button>    
       
       <hr />
       
       <asp:Label id="UploadStatusLabel"
           runat="server">
       </asp:Label>           
    </div>
    </form>
</body>
</html>
<%@ Page Language="VB" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">
    Sub UploadButton_Click(ByVal sender As Object, ByVal e As System.EventArgs)
            
        ' Save the uploaded file to an "Uploads" directory
        ' that already exists in the file system of the 
        ' currently executing ASP.NET application.  
        ' Creating an "Uploads" directory isolates uploaded 
        ' files in a separate directory. This helps prevent
        ' users from overwriting existing application files by
        ' uploading files with names like "Web.config".
        Dim saveDir As String = "\Uploads\"
           
        ' Get the physical file system path for the currently
        ' executing application.
        Dim appPath As String = Request.PhysicalApplicationPath
            
        ' Before attempting to save the file, verify
        ' that the FileUpload control contains a file.
        If (FileUpload1.HasFile) Then
            Dim savePath As String = appPath + saveDir + _
                Server.HtmlEncode(FileUpload1.FileName)
                        
            ' Call the SaveAs method to save the 
            ' uploaded file to the specified path.
            ' This example does not perform all
            ' the necessary error checking.               
            ' If a file with the same name
            ' already exists in the specified path,  
            ' the uploaded file overwrites it.
            FileUpload1.SaveAs(savePath)
                
            ' Notify the user that the file was uploaded successfully.
            UploadStatusLabel.Text = "Your file was uploaded successfully."

        Else
            ' Notify the user that a file was not uploaded.
            UploadStatusLabel.Text = "You did not specify a file to upload."
        End If

    End Sub
       
</script>
    
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>FileUpload Class Example</title>
</head>
<body>
   <h3>FileUpload Class Example: Save To Application Directory</h3>
   <form id="form1" runat="server">
   <div>   
       <h4>Select a file to upload:</h4>
   
       <asp:FileUpload id="FileUpload1"                 
           runat="server">
       </asp:FileUpload>
            
       <br/><br/>
       
       <asp:Button id="UploadButton" 
           Text="Upload file"
           OnClick="UploadButton_Click"
           runat="server">
       </asp:Button>    
       
       <hr />
       
       <asp:Label id="UploadStatusLabel"
           runat="server">
       </asp:Label>       
         
   </div>
   </form>
</body>
</html>

다음 예제에서는 만드는 방법을 보여 줍니다는 FileUpload 코드에 지정 된 경로에 파일을 저장 하는 컨트롤입니다. 컨트롤은 업로드할 수 있는 파일의 크기를 2MB로 제한합니다. 합니다 PostedFile 속성은 기본 액세스 데 ContentLength 속성과 파일의 크기를 반환 합니다. 업로드할 파일의 크기가 2MB 보다 작은 경우는 SaveAs 메서드를 호출 하는 서버에서 지정된 된 경로에 파일을 저장 합니다. 애플리케이션 코드에서 최대 파일 크기 설정을 확인하는 것 외에도 httpRuntime 요소의 특성을 애플리케이션의 구성 파일에서 허용되는 최대 크기로 설정할 maxRequestLength 수 있습니다.

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

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

    protected void UploadButton_Click(object sender, EventArgs e)
    {
        // Specify the path on the server to
        // save the uploaded file to.
        string savePath = @"c:\temp\uploads\";
                       
        // Before attempting to save the file, verify
        // that the FileUpload control contains a file.
        if (FileUpload1.HasFile)
        {                
            // Get the size in bytes of the file to upload.
            int fileSize = FileUpload1.PostedFile.ContentLength;
          
            // Allow only files less than 2,100,000 bytes (approximately 2 MB) to be uploaded.
            if (fileSize < 2100000)
            {
                        
                // Append the name of the uploaded file to the path.
                savePath += Server.HtmlEncode(FileUpload1.FileName);

                // Call the SaveAs method to save the 
                // uploaded file to the specified path.
                // This example does not perform all
                // the necessary error checking.               
                // If a file with the same name
                // already exists in the specified path,  
                // the uploaded file overwrites it.
                FileUpload1.SaveAs(savePath);
                
                // Notify the user that the file was uploaded successfully.
                UploadStatusLabel.Text = "Your file was uploaded successfully.";
            }
            else
            {
                // Notify the user why their file was not uploaded.
                UploadStatusLabel.Text = "Your file was not uploaded because " + 
                                         "it exceeds the 2 MB size limit.";
            }
        }   
        else
        {
            // Notify the user that a file was not uploaded.
            UploadStatusLabel.Text = "You did not specify a file to upload.";
        }
    }
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>FileUpload Class Example</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
       <h4>Select a file to upload:</h4>
   
       <asp:FileUpload id="FileUpload1"                 
           runat="server">
       </asp:FileUpload>
            
       <br/><br/>
       
       <asp:Button id="UploadButton" 
           Text="Upload file"
           OnClick="UploadButton_Click"
           runat="server">
       </asp:Button>
       
       <hr />
       
       <asp:Label id="UploadStatusLabel"
           runat="server">
       </asp:Label>
           
    </div>
    </form>
</body>
</html>
<%@ Page Language="VB" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

    Protected Sub UploadButton_Click(ByVal sender As Object, ByVal e As System.EventArgs)
        
        ' Specify the path on the server to
        ' save the uploaded file to.
        Dim savePath As String = "c:\temp\uploads\"
                       
        ' Before attempting to save the file, verify
        ' that the FileUpload control contains a file.
        If (FileUpload1.HasFile) Then
                
            ' Get the size in bytes of the file to upload.
            Dim fileSize As Integer = FileUpload1.PostedFile.ContentLength
          
            ' Allow only files less than 2,100,000 bytes (approximately 2 MB) to be uploaded.
            If (fileSize < 2100000) Then
                        
                ' Append the name of the uploaded file to the path.
                savePath += Server.HtmlEncode(FileUpload1.FileName)

                ' Call the SaveAs method to save the 
                ' uploaded file to the specified path.
                ' This example does not perform all
                ' the necessary error checking.               
                ' If a file with the same name
                ' already exists in the specified path,  
                ' the uploaded file overwrites it.
                FileUpload1.SaveAs(savePath)
                
                ' Notify the user that the file was uploaded successfully.
                UploadStatusLabel.Text = "Your file was uploaded successfully."
            
            Else
                ' Notify the user why their file was not uploaded.
                UploadStatusLabel.Text = "Your file was not uploaded because " + _
                                         "it exceeds the 2 MB size limit."
            End If
                
        Else
            ' Notify the user that a file was not uploaded.
            UploadStatusLabel.Text = "You did not specify a file to upload."
        End If

    End Sub
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>FileUpload Class Example</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
       <h4>Select a file to upload:</h4>
   
       <asp:FileUpload id="FileUpload1"                 
           runat="server">
       </asp:FileUpload>
            
       <br/><br/>
       
       <asp:Button id="UploadButton" 
           Text="Upload file"
           OnClick="UploadButton_Click"
           runat="server">
       </asp:Button>
       
       <hr />
       
       <asp:Label id="UploadStatusLabel"
           runat="server">
       </asp:Label>
           
    </div>
    </form>
</body>
</html>

다음 예제에서는 만드는 방법을 보여 줍니다는 FileUpload 코드에 지정 된 경로에 파일을 저장 하는 컨트롤입니다. 이 예제는 업로드할.xls 또는.doc 파일 이름 확장명을 가진 파일만이 있습니다. Path.GetExtension 메서드는 업로드할 파일의 확장명을 반환 합니다. 파일에는.xls 또는.doc 파일 이름 확장명을 SaveAs 메서드를 호출 하는 서버에서 지정된 된 경로에 파일을 저장 합니다.

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

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

    protected void UploadBtn_Click(object sender, EventArgs e)
    {
        // Specify the path on the server to
        // save the uploaded file to.
        string savePath = @"c:\temp\uploads";

        // Before attempting to save the file, verify
        // that the FileUpload control contains a file.
        if (FileUpload1.HasFile)
        {
            // Get the name of the file to upload.
            string fileName = Server.HtmlEncode(FileUpload1.FileName);

            // Get the extension of the uploaded file.
            string extension = System.IO.Path.GetExtension(fileName);
            
            // Allow only files with .doc or .xls extensions
            // to be uploaded.
            if ((extension == ".doc") || (extension == ".xls"))
            {
                // Append the name of the file to upload to the path.
                savePath += fileName;

                // Call the SaveAs method to save the 
                // uploaded file to the specified path.
                // This example does not perform all
                // the necessary error checking.               
                // If a file with the same name
                // already exists in the specified path,  
                // the uploaded file overwrites it.
                FileUpload1.SaveAs(savePath);
                
                // Notify the user that their file was successfully uploaded.
                UploadStatusLabel.Text = "Your file was uploaded successfully.";
            }
            else
            {
                // Notify the user why their file was not uploaded.
                UploadStatusLabel.Text = "Your file was not uploaded because " + 
                                         "it does not have a .doc or .xls extension.";
            }

        }

    }

</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>FileUpload Class Example</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <h4>Select a file to upload:</h4>
       
        <asp:FileUpload id="FileUpload1"                 
            runat="server">
        </asp:FileUpload>
            
        <br/><br/>
       
        <asp:Button id="UploadBtn" 
            Text="Upload file"
            OnClick="UploadBtn_Click"
            runat="server">
        </asp:Button>    
       
        <hr />
       
        <asp:Label id="UploadStatusLabel"
            runat="server">
        </asp:Label>     
    </div>
    </form>
</body>
</html>
<%@ Page Language="VB" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

    Protected Sub UploadBtn_Click(ByVal sender As Object, ByVal e As System.EventArgs)
        ' Specify the path on the server to
        ' save the uploaded file to.
        Dim savePath As String = "c:\temp\uploads\"
            
        ' Before attempting to save the file, verify
        ' that the FileUpload control contains a file.
        If (FileUpload1.HasFile) Then
            
            ' Get the name of the file to upload.
            Dim fileName As String = Server.HtmlEncode(FileUpload1.FileName)
            
            ' Get the extension of the uploaded file.
            Dim extension As String = System.IO.Path.GetExtension(fileName)
            
            ' Allow only files with .doc or .xls extensions
            ' to be uploaded.
            If (extension = ".doc") Or (extension = ".xls") Then
                        
                ' Append the name of the file to upload to the path.
                savePath += fileName
            
                ' Call the SaveAs method to save the 
                ' uploaded file to the specified path.
                ' This example does not perform all
                ' the necessary error checking.               
                ' If a file with the same name
                ' already exists in the specified path,  
                ' the uploaded file overwrites it.
                FileUpload1.SaveAs(savePath)
                
                ' Notify the user that their file was successfully uploaded.
                UploadStatusLabel.Text = "Your file was uploaded successfully."
            
            Else
                ' Notify the user why their file was not uploaded.
                UploadStatusLabel.Text = "Your file was not uploaded because " + _
                                         "it does not have a .doc or .xls extension."
            End If
                
        Else
            ' Notify the user that a file was not uploaded.
            UploadStatusLabel.Text = "You did not specify a file to upload."
        End If
    End Sub
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>FileUpload Class Example</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <h4>Select a file to upload:</h4>
       
        <asp:FileUpload id="FileUpload1"                 
            runat="server">
        </asp:FileUpload>
            
        <br/><br/>
       
        <asp:Button id="UploadBtn" 
            Text="Upload file"
            OnClick="UploadBtn_Click"
            runat="server">
        </asp:Button>    
       
        <hr />
       
        <asp:Label id="UploadStatusLabel"
            runat="server">
        </asp:Label>     
    </div>
    </form>
</body>
</html>

설명

항목 내용

소개

FileUpload 클래스 텍스트 상자 컨트롤 및 클라이언트에서 파일을 선택 하 고 웹 서버에 업로드 하는 데 사용할 수 있는 찾아보기 단추를 표시 합니다. 사용자가 로컬 컴퓨터에 있는 파일의 전체 경로 입력 하 여 업로드할 파일 지정 (예를 들어 C:\MyFiles\TestFile.txt) 컨트롤의 텍스트 상자에 있습니다. 사용자가 클릭 하 여 파일을 선택할 수는 또는 찾아보기 단추를 클릭 한 다음에 배치 합니다 파일 선택 대화 상자.

사용 된 FileName 속성을 사용 하 여 업로드할 클라이언트의 파일의 이름을 가져옵니다는 FileUpload 컨트롤입니다. 이 속성을 반환 하는 파일 이름에는 클라이언트에서 파일의 경로 포함 되지 않습니다.

합니다 FileContent 속성을 Stream 업로드할 파일을 가리키는 개체입니다. 바이트 형식으로 파일의 내용에 액세스 하려면이 속성을 사용 합니다. 예를 들어 사용할 수 있습니다 합니다 Stream 에서 반환 되는 개체는 FileContent 바이트로 파일의 내용의 읽을 바이트 배열에 저장 하는 속성입니다. 사용할 수 있습니다는 FileBytes 파일의 모든 바이트를 검색할 속성입니다.

합니다 PostedFile 기본 속성을 가져옵니다 HttpPostedFile 업로드할 파일에 대 한 개체입니다. 파일에서 추가 속성에 액세스 하려면이 속성을 사용할 수 있습니다. ContentLength 속성 파일의 길이 가져옵니다. ContentType 속성 파일의 MIME 콘텐츠 형식을 가져옵니다. 또한 사용할 수 있습니다는 PostedFile 속성에 액세스를 FileName 속성을 InputStream 속성 및 SaveAs 메서드. 하지만 동일한 기능을 제공를 FileName 속성을 FileContent 속성 및 SaveAs 메서드.

업로드 한 파일을 저장 하는 중

FileUpload 컨트롤이 자동으로를 저장 하지 않습니다 파일 서버 사용자가 업로드할 파일을 선택 합니다. 명시적으로 제어 또는 사용자가 지정된 된 파일을 제출 하도록 허용 하는 메커니즘을 제공 해야 합니다. 예를 들어 사용자가 파일을 업로드 하는 단추를 제공할 수 있습니다. 지정된 된 파일을 저장 하려면 작성 하는 코드를 호출 해야 합니다 SaveAs 메서드를 서버에서 파일의 내용이 지정된 된 경로에 저장 합니다. 일반적으로 SaveAs 서버에 다시 게시를 발생 시키는 이벤트에 대 한 이벤트 처리 메서드에서 호출 됩니다. 예를 들어 파일을 전송 하는 단추를 제공 하는 경우에 클릭 이벤트에 대 한 이벤트 처리 메서드 내에서 파일을 저장 하는 코드를 포함할 수 있습니다.

호출 하기 전에 SaveAs 메서드를 사용 하 여 서버에 파일을 저장 합니다 HasFile ; 속성을 확인 하는 FileUpload 파일을 포함 하는 컨트롤. 경우는 HasFile 반환 true를 호출 합니다 SaveAs 메서드. 반환 하는 경우 false를 나타내는 사용자 컨트롤 파일 없습니다 메시지를 표시 합니다. 검사 안 함은 PostedFile 업로드할 파일을 여부를 확인 하려면 속성이 존재 하므로 기본적으로이 속성에 0 바이트를 포함 합니다. 결과적으로, 경우에 합니다 FileUpload 컨트롤은 빈는 PostedFile 속성이 null이 아닌 값을 반환 합니다.

보안 고려사항

호출 하는 경우는 SaveAs 메서드를 업로드 한 파일을 저장 하는 디렉터리의 전체 경로 지정 해야 합니다. 애플리케이션 코드에서 경로 명시적으로 지정 하지 않는 경우 사용자가 파일을 업로드 하려고 할 때 예외가 throw 됩니다. 이 동작 덕분에 인해 중요 한 루트 디렉터리에 액세스할 수 있을 뿐만 아니라 애플리케이션의 디렉터리 구조 내에서 임의의 위치에 쓸 수 없도록 방지 하 여 서버에서 파일을 안전 합니다.

SaveAs 메서드는 지정된 된 디렉터리에 업로드 된 파일을 씁니다. 따라서 ASP.NET 애플리케이션 서버의 디렉터리에 대 한 쓰기 액세스 있어야 합니다. 두 가지 방법으로 애플리케이션 쓰기 액세스를 얻을 수 있습니다. 명시적으로 애플리케이션이 실행 되 고 있는, 업로드 된 파일을 저장할 디렉터리의 계정에 대 한 쓰기 액세스를 부여할 수 있습니다. 또는 ASP.NET 애플리케이션에 부여 되는 신뢰 수준을 늘릴 수 있습니다. 애플리케이션에 대 한 실행 디렉터리에 대 한 쓰기 액세스를 가져오려는 애플리케이션을 부여 해야 합니다는 AspNetHostingPermission 신뢰 수준이 설정 하는 개체는 AspNetHostingPermissionLevel.Medium 값입니다. 신뢰 수준을 증가 서버의 리소스에 대 한 애플리케이션의 액세스 합니다. 않음을 유의이 방법은 보안상 악의적인 사용자가 애플리케이션에 대 한 제어도 되므로이 더 높은 수준의 신뢰에서 실행할 수 있습니다. 애플리케이션 실행에 필요한 최소 권한 가진 사용자의 컨텍스트에서 ASP.NET 애플리케이션을 실행 하는 것이 좋습니다. ASP.NET 애플리케이션의 보안에 대 한 자세한 내용은 참조 하세요. 웹 애플리케이션에 대 한 기본 보안 사례 하 고 ASP.NET 신뢰 수준과 정책 파일합니다.

메모리 제한 사항

첫 번째 보호 서비스 거부에 대 한 공격 방법은 사용 하 여 업로드할 수 있는 파일의 크기를 제한 하는 FileUpload 제어 합니다. 업로드 하려는 파일의 형식에 대 한 적절 한 크기 제한을 설정 해야 합니다. 기본 크기 제한은 4096 킬로바이트 (KB) 또는 4 메가바이트 (MB)입니다. httpRuntime 요소의 특성을 설정 maxRequestLength 하여 더 큰 파일을 업로드하도록 허용할 수 있습니다. 전체 애플리케이션에 대 한 최대 허용 파일 크기를 늘리려면 설정 된 maxRequestLength Web.config 파일에는 특성입니다. 지정된 된 페이지에 대 한 최대 허용 파일 크기를 늘리려면 설정 합니다 maxRequestLength 내에서 특성을 location Web.config의 요소. 예를 들어 참조 location 요소 (ASP.NET 설정 스키마)합니다.

큰 파일을 업로드 하는 경우 사용자에도 다음과 같은 오류 메시지가 나타날:

aspnet_wp.exe (PID: 1520) was recycled because memory consumption exceeded 460 MB (60 percent of available RAM).

사용자에게 이 오류 메시지가 표시되면 애플리케이션에 대한 Web.config 파일 요소의 memoryLimitprocessModel 에서 특성 값을 늘입니다. memoryLimit 특성 최대 작업자 프로세스를 사용할 수 있는 메모리 양을 지정 합니다. 작업자 프로세스를 초과 하는 경우는 memoryLimit amount를 대체할 새 프로세스가 만들어질 및 모든 현재 요청이 새 프로세스에 다시 할당 됩니다.

업로드할 파일이 일시적으로 메모리에 저장되는지 또는 요청이 처리되는 동안 서버에 저장되는지 여부를 제어하려면 httpRuntime 요소의 특성을 설정합니다requestLengthDiskThreshold. 이 특성을 사용 하면 입력된 스트림 버퍼의 크기를 관리할 수 있습니다. 기본값은 256 바이트입니다. 에 대해 지정 하는 값을 지정 하는 값을 초과할 수 없습니다는 maxRequestLength 특성입니다.

UpdatePanel 컨트롤을 사용 하 여 FileUpload 컨트롤 사용

FileUpload 컨트롤은 부분 페이지 렌더링 하는 동안 비동기 포스트백 시나리오 및 포스트백 시나리오 에서만에서 사용 되도록 설계 되었습니다. 사용 하는 경우는 FileUpload 컨트롤 내부를 UpdatePanel 컨트롤에 있는 컨트롤을 사용 하 여 파일을 업로드 해야 합니다는 PostBackTrigger 패널에 대 한 개체입니다. UpdatePanel 컨트롤에서 포스트백을 사용 하 여 전체 페이지를 업데이트 하는 대신 페이지의 선택된 영역을 업데이트 하는 데 사용 됩니다. 자세한 내용은 UpdatePanel 컨트롤 개요 하 고 부분 페이지 렌더링 개요합니다.

선언 구문

<asp:FileUpload  
    AccessKey="string"  
    BackColor="color name|#dddddd"  
    BorderColor="color name|#dddddd"  
    BorderStyle="NotSet|None|Dotted|Dashed|Solid|Double|Groove|Ridge|  
        Inset|Outset"  
    BorderWidth="size"  
    CssClass="string"  
    Enabled="True|False"  
    EnableTheming="True|False"  
    EnableViewState="True|False"  
    Font-Bold="True|False"  
    Font-Italic="True|False"  
    Font-Names="string"  
    Font-Overline="True|False"  
    Font-Size="string|Smaller|Larger|XX-Small|X-Small|Small|Medium|  
        Large|X-Large|XX-Large"  
    Font-Strikeout="True|False"  
    Font-Underline="True|False"  
    ForeColor="color name|#dddddd"  
    Height="size"  
    ID="string"  
    OnDataBinding="DataBinding event handler"  
    OnDisposed="Disposed event handler"  
    OnInit="Init event handler"  
    OnLoad="Load event handler"  
    OnPreRender="PreRender event handler"  
    OnUnload="Unload event handler"  
    runat="server"  
    SkinID="string"  
    Style="string"  
    TabIndex="integer"  
    ToolTip="string"  
    Visible="True|False"  
    Width="size"  
/>  

생성자

FileUpload()

FileUpload 클래스의 새 인스턴스를 초기화합니다.

속성

AccessKey

웹 서버 컨트롤을 빠르게 탐색할 수 있는 선택키를 가져오거나 설정합니다.

(다음에서 상속됨 WebControl)
Adapter

컨트롤에 대한 브라우저별 어댑터를 가져옵니다.

(다음에서 상속됨 Control)
AllowMultiple

업로드 시 여러 파일을 선택할 수 있는지 여부를 지정하는 값을 가져오거나 설정합니다.

AppRelativeTemplateSourceDirectory

이 컨트롤이 포함된 Page 또는 UserControl 개체의 애플리케이션 상대 가상 디렉터리를 가져오거나 설정합니다.

(다음에서 상속됨 Control)
Attributes

컨트롤의 속성과 일치하지 않는 임의의 특성(렌더링하는 경우에만 해당)의 컬렉션을 가져옵니다.

(다음에서 상속됨 WebControl)
BackColor

웹 서버 컨트롤의 배경색을 가져오거나 설정합니다.

(다음에서 상속됨 WebControl)
BindingContainer

이 컨트롤의 데이터 바인딩이 포함된 컨트롤을 가져옵니다.

(다음에서 상속됨 Control)
BorderColor

웹 컨트롤의 테두리 색을 가져오거나 설정합니다.

(다음에서 상속됨 WebControl)
BorderStyle

웹 서버 컨트롤의 테두리 스타일을 가져오거나 설정합니다.

(다음에서 상속됨 WebControl)
BorderWidth

웹 서버 컨트롤의 테두리 너비를 가져오거나 설정합니다.

(다음에서 상속됨 WebControl)
ChildControlsCreated

서버 컨트롤의 자식 컨트롤이 만들어졌는지 여부를 나타내는 값을 가져옵니다.

(다음에서 상속됨 Control)
ClientID

ASP.NET에서 생성하는 HTML 태그의 컨트롤 ID를 가져옵니다.

(다음에서 상속됨 Control)
ClientIDMode

ClientID 속성의 값을 생성하는 데 사용되는 알고리즘을 가져오거나 설정합니다.

(다음에서 상속됨 Control)
ClientIDSeparator

ClientID 속성에 사용된 구분 문자를 나타내는 문자 값을 가져옵니다.

(다음에서 상속됨 Control)
Context

현재 웹 요청에 대한 서버 컨트롤과 관련된 HttpContext 개체를 가져옵니다.

(다음에서 상속됨 Control)
Controls

UI 계층 구조에서 지정된 서버 컨트롤의 자식 컨트롤을 나타내는 ControlCollection 개체를 가져옵니다.

(다음에서 상속됨 Control)
ControlStyle

웹 서버 컨트롤의 스타일을 가져옵니다. 이 속성은 주로 컨트롤 개발자가 사용합니다.

(다음에서 상속됨 WebControl)
ControlStyleCreated

Style 개체가 ControlStyle 속성에 대해 만들어졌는지 여부를 나타내는 값을 가져옵니다. 이 속성은 주로 컨트롤 개발자가 사용합니다.

(다음에서 상속됨 WebControl)
CssClass

클라이언트의 웹 서버 컨트롤에서 렌더링한 CSS 스타일시트 클래스를 가져오거나 설정합니다.

(다음에서 상속됨 WebControl)
DataItemContainer

명명 컨테이너가 IDataItemContainer를 구현할 경우 명명 컨테이너에 대한 참조를 가져옵니다.

(다음에서 상속됨 Control)
DataKeysContainer

명명 컨테이너가 IDataKeysControl를 구현할 경우 명명 컨테이너에 대한 참조를 가져옵니다.

(다음에서 상속됨 Control)
DesignMode

디자인 화면에서 컨트롤이 사용 중인지 여부를 나타내는 값을 가져옵니다.

(다음에서 상속됨 Control)
Enabled

웹 서버 컨트롤이 활성화되어 있는지 여부를 나타내는 값을 가져오거나 설정합니다.

(다음에서 상속됨 WebControl)
EnableTheming

이 컨트롤에 테마를 적용할지 여부를 나타내는 값을 가져오거나 설정합니다.

(다음에서 상속됨 WebControl)
EnableViewState

서버 컨트롤이 해당 뷰 상태와 포함하고 있는 모든 자식 컨트롤의 뷰 상태를, 요청하는 클라이언트까지 유지하는지 여부를 나타내는 값을 가져오거나 설정합니다.

(다음에서 상속됨 Control)
Events

컨트롤에 대한 이벤트 처리기 대리자의 목록을 가져옵니다. 이 속성은 읽기 전용입니다.

(다음에서 상속됨 Control)
FileBytes

FileUpload 컨트롤을 사용하여 지정된 파일의 바이트 배열을 가져옵니다.

FileContent

Stream 컨트롤을 사용하여 업로드할 파일을 가리키는 FileUpload 개체를 가져옵니다.

FileName

FileUpload 컨트롤을 사용하여 업로드할 클라이언트의 파일 이름을 가져옵니다.

Font

웹 서버 컨트롤과 연결된 글꼴 속성을 가져옵니다.

(다음에서 상속됨 WebControl)
ForeColor

웹 서버 컨트롤의 전경색(보통 텍스트 색)을 가져오거나 설정합니다.

(다음에서 상속됨 WebControl)
HasAttributes

컨트롤에 특성 집합이 있는지 여부를 나타내는 값을 가져옵니다.

(다음에서 상속됨 WebControl)
HasChildViewState

현재 서버 컨트롤의 자식 컨트롤에 저장된 뷰 상태 설정 값이 있는지 여부를 나타내는 값을 가져옵니다.

(다음에서 상속됨 Control)
HasFile

FileUpload 컨트롤에 파일이 들어 있는지 여부를 나타내는 값을 가져옵니다.

HasFiles

임의의 파일이 업로드되었는지 여부를 나타내는 값을 가져옵니다.

Height

웹 서버 컨트롤의 높이를 가져오거나 설정합니다.

(다음에서 상속됨 WebControl)
ID

서버 컨트롤에 할당된 프로그래밍 ID를 가져오거나 설정합니다.

(다음에서 상속됨 Control)
IdSeparator

컨트롤 식별자를 구분하는 데 사용되는 문자를 가져옵니다.

(다음에서 상속됨 Control)
IsChildControlStateCleared

이 컨트롤에 포함된 컨트롤이 컨트롤 상태를 가지는지 여부를 나타내는 값을 가져옵니다.

(다음에서 상속됨 Control)
IsEnabled

컨트롤을 사용할 수 있는지 여부를 나타내는 값을 가져옵니다.

(다음에서 상속됨 WebControl)
IsTrackingViewState

서버 컨트롤에서 해당 뷰 상태의 변경 사항을 저장하는지 여부를 나타내는 값을 가져옵니다.

(다음에서 상속됨 Control)
IsViewStateEnabled

이 컨트롤의 뷰 상태를 사용할 수 있는지 여부를 나타내는 값을 가져옵니다.

(다음에서 상속됨 Control)
LoadViewStateByID

인덱스 대신 ID별로 뷰 상태를 로드할 때 컨트롤이 참여하는지 여부를 나타내는 값을 가져옵니다.

(다음에서 상속됨 Control)
NamingContainer

동일한 ID 속성 값을 사용하는 서버 컨트롤을 구별하기 위해 고유의 네임스페이스를 만드는 서버 컨트롤의 명명 컨테이너에 대한 참조를 가져옵니다.

(다음에서 상속됨 Control)
Page

서버 컨트롤이 들어 있는 Page 인스턴스에 대한 참조를 가져옵니다.

(다음에서 상속됨 Control)
Parent

페이지 컨트롤 계층 구조에서 서버 컨트롤의 부모 컨트롤에 대한 참조를 가져옵니다.

(다음에서 상속됨 Control)
PostedFile

FileUpload 컨트롤을 사용하여 업로드된 파일의 내부 HttpPostedFile 개체를 가져옵니다.

PostedFiles

업로드된 파일의 컬렉션을 가져옵니다.

RenderingCompatibility

렌더링된 HTML이 호환될 ASP.NET 버전을 지정하는 값을 가져옵니다.

(다음에서 상속됨 Control)
Site

디자인 화면에서 렌더링될 때 현재 컨트롤을 호스팅하는 컨테이너 관련 정보를 가져옵니다.

(다음에서 상속됨 Control)
SkinID

컨트롤에 적용할 스킨을 가져오거나 설정합니다.

(다음에서 상속됨 WebControl)
Style

웹 서버 컨트롤의 외부 태그에서 스타일 특성으로 렌더링할 텍스트 특성의 컬렉션을 가져옵니다.

(다음에서 상속됨 WebControl)
SupportsDisabledAttribute

컨트롤의 IsEnabled 속성이 false인 경우 컨트롤이 렌더링된 HTML 요소의 disabled 특성을 "disabled"로 설정할지 여부를 나타내는 값을 가져옵니다.

(다음에서 상속됨 WebControl)
TabIndex

웹 서버 컨트롤의 탭 인덱스를 가져오거나 설정합니다.

(다음에서 상속됨 WebControl)
TagKey

이 웹 서버 컨트롤에 해당하는 HtmlTextWriterTag 값을 가져옵니다. 이 속성은 주로 컨트롤 개발자가 사용합니다.

(다음에서 상속됨 WebControl)
TagName

컨트롤 태그의 이름을 가져옵니다. 이 속성은 주로 컨트롤 개발자가 사용합니다.

(다음에서 상속됨 WebControl)
TemplateControl

이 컨트롤이 포함된 템플릿의 참조를 가져오거나 설정합니다.

(다음에서 상속됨 Control)
TemplateSourceDirectory

Page 또는 현재 서버 컨트롤이 들어 있는 UserControl의 가상 디렉터리를 가져옵니다.

(다음에서 상속됨 Control)
ToolTip

마우스 포인터를 웹 서버 컨트롤 위로 가져갈 때 표시되는 텍스트를 가져오거나 설정합니다.

(다음에서 상속됨 WebControl)
UniqueID

서버 컨트롤에 대해 계층적으로 정규화된 고유 식별자를 가져옵니다.

(다음에서 상속됨 Control)
ValidateRequestMode

잠재적으로 위험한 값이 있는지 확인하기 위해 컨트롤에서 브라우저의 클라이언트 입력을 검사하는지 여부를 나타내는 값을 가져오거나 설정합니다.

(다음에서 상속됨 Control)
ViewState

같은 페이지에 대한 여러 개의 요청 전반에 서버 컨트롤의 뷰 상태를 저장하고 복원할 수 있도록 하는 상태 정보 사전을 가져옵니다.

(다음에서 상속됨 Control)
ViewStateIgnoresCase

StateBag 개체가 대/소문자를 구분하는지 여부를 나타내는 값을 가져옵니다.

(다음에서 상속됨 Control)
ViewStateMode

이 컨트롤의 뷰 상태 모드를 가져오거나 설정합니다.

(다음에서 상속됨 Control)
Visible

페이지에서 서버 컨트롤이 UI로 렌더링되는지 여부를 나타내는 값을 가져오거나 설정합니다.

(다음에서 상속됨 Control)
Width

웹 서버 컨트롤의 너비를 가져오거나 설정합니다.

(다음에서 상속됨 WebControl)

메서드

AddAttributesToRender(HtmlTextWriter)

지정된 HtmlTextWriter 개체에 렌더링할 FileUpload 컨트롤의 HTML 특성 및 스타일을 추가합니다.

AddedControl(Control, Int32)

자식 컨트롤이 Control 개체의 Controls 컬렉션에 추가된 후 호출됩니다.

(다음에서 상속됨 Control)
AddParsedSubObject(Object)

XML 또는 HTML 요소가 구문 분석되었음을 서버 컨트롤에 알리고 서버 컨트롤의 ControlCollection 개체에 요소를 추가합니다.

(다음에서 상속됨 Control)
ApplyStyle(Style)

지정된 스타일의 비어 있지 않은 요소를 웹 컨트롤에 복사하고 컨트롤의 기존 스타일 요소를 덮어씁니다. 이 메서드는 주로 컨트롤 개발자가 사용합니다.

(다음에서 상속됨 WebControl)
ApplyStyleSheetSkin(Page)

페이지 스타일시트에 정의된 스타일 속성을 컨트롤에 적용합니다.

(다음에서 상속됨 Control)
BeginRenderTracing(TextWriter, Object)

렌더링 데이터의 디자인 타임 추적을 시작합니다.

(다음에서 상속됨 Control)
BuildProfileTree(String, Boolean)

서버 컨트롤에 대한 정보를 수집하고, 페이지에 대해 추적이 활성화된 경우 표시할 Trace 속성에 이 정보를 전달합니다.

(다음에서 상속됨 Control)
ClearCachedClientID()

캐시된 ClientID 값을 null로 설정합니다.

(다음에서 상속됨 Control)
ClearChildControlState()

서버 컨트롤의 자식 컨트롤에 대한 컨트롤 상태 정보를 삭제합니다.

(다음에서 상속됨 Control)
ClearChildState()

서버 컨트롤의 모든 자식 컨트롤에 대한 뷰 상태 정보와 컨트롤 상태 정보를 삭제합니다.

(다음에서 상속됨 Control)
ClearChildViewState()

서버 컨트롤의 모든 자식 컨트롤에 대한 뷰 상태 정보를 삭제합니다.

(다음에서 상속됨 Control)
ClearEffectiveClientIDMode()

현재 컨트롤 인스턴스 및 자식 컨트롤의 ClientIDMode 속성을 Inherit로 설정합니다.

(다음에서 상속됨 Control)
CopyBaseAttributes(WebControl)

Style 개체에 캡슐화하지 않은 속성을 지정된 웹 서버 컨트롤에서 이 메서드가 호출된 원본 웹 서버 컨트롤에 복사합니다. 이 메서드는 주로 컨트롤 개발자에 의해 사용됩니다.

(다음에서 상속됨 WebControl)
CreateChildControls()

다시 게시 또는 렌더링하기 위한 준비 작업으로, 포함된 자식 컨트롤을 만들도록 컴퍼지션 기반 구현을 사용하는 서버 컨트롤에 알리기 위해 ASP.NET 페이지 프레임워크에 의해 호출됩니다.

(다음에서 상속됨 Control)
CreateControlCollection()

서버 컨트롤의 자식 컨트롤(리터럴 및 서버)을 보유할 새 ControlCollection 개체를 만듭니다.

(다음에서 상속됨 Control)
CreateControlStyle()

WebControl 클래스에서 모든 스타일 관련 속성을 구현하기 위해 내부적으로 사용되는 스타일 개체를 만듭니다. 이 메서드는 주로 컨트롤 개발자에 의해 사용됩니다.

(다음에서 상속됨 WebControl)
DataBind()

호출된 서버 컨트롤과 모든 해당 자식 컨트롤에 데이터 원본을 바인딩합니다.

(다음에서 상속됨 Control)
DataBind(Boolean)

DataBinding 이벤트를 발생시키는 옵션을 사용하여, 호출된 서버 컨트롤과 모든 자식 컨트롤에 데이터 소스를 바인딩합니다.

(다음에서 상속됨 Control)
DataBindChildren()

데이터 소스를 서버 컨트롤의 자식 컨트롤에 바인딩합니다.

(다음에서 상속됨 Control)
Dispose()

서버 컨트롤이 메모리에서 해제되기 전에 해당 서버 컨트롤에서 최종 정리 작업을 수행하도록 합니다.

(다음에서 상속됨 Control)
EndRenderTracing(TextWriter, Object)

렌더링 데이터의 디자인 타임 추적을 종료합니다.

(다음에서 상속됨 Control)
EnsureChildControls()

서버 컨트롤에 자식 컨트롤이 있는지 확인합니다. 서버 컨트롤에 자식 컨트롤이 없으면 자식 컨트롤을 만듭니다.

(다음에서 상속됨 Control)
EnsureID()

ID가 할당되지 않은 컨트롤의 ID를 만듭니다.

(다음에서 상속됨 Control)
Equals(Object)

지정된 개체가 현재 개체와 같은지 확인합니다.

(다음에서 상속됨 Object)
FindControl(String)

지정된 id 매개 변수를 사용하여 서버 컨트롤의 현재 명명 컨테이너를 검색합니다.

(다음에서 상속됨 Control)
FindControl(String, Int32)

현재 명명 컨테이너에서 특정 id와 함께 pathOffset 매개 변수에 지정된 검색용 정수를 사용하여 서버 컨트롤을 검색합니다. 이 버전의 FindControl 메서드를 재정의해서는 안됩니다.

(다음에서 상속됨 Control)
Focus()

컨트롤에 입력 포커스를 설정합니다.

(다음에서 상속됨 Control)
GetDesignModeState()

컨트롤의 디자인 타임 데이터를 가져옵니다.

(다음에서 상속됨 Control)
GetHashCode()

기본 해시 함수로 작동합니다.

(다음에서 상속됨 Object)
GetRouteUrl(Object)

루트 매개 변수 집합에 해당하는 URL을 가져옵니다.

(다음에서 상속됨 Control)
GetRouteUrl(RouteValueDictionary)

루트 매개 변수 집합에 해당하는 URL을 가져옵니다.

(다음에서 상속됨 Control)
GetRouteUrl(String, Object)

루트 매개 변수 집합 및 루트 이름에 해당하는 URL을 가져옵니다.

(다음에서 상속됨 Control)
GetRouteUrl(String, RouteValueDictionary)

루트 매개 변수 집합 및 루트 이름에 해당하는 URL을 가져옵니다.

(다음에서 상속됨 Control)
GetType()

현재 인스턴스의 Type을 가져옵니다.

(다음에서 상속됨 Object)
GetUniqueIDRelativeTo(Control)

지정된 컨트롤의 UniqueID 속성에서 접두사 부분을 반환합니다.

(다음에서 상속됨 Control)
HasControls()

서버 컨트롤에 자식 컨트롤이 있는지 확인합니다.

(다음에서 상속됨 Control)
HasEvents()

이벤트가 컨트롤이나 자식 컨트롤에 등록되었는지 여부를 나타내는 값을 반환합니다.

(다음에서 상속됨 Control)
IsLiteralContent()

서버 컨트롤에 리터럴 내용만 저장되어 있는지 확인합니다.

(다음에서 상속됨 Control)
LoadControlState(Object)

SaveControlState() 메서드에서 저장한 이전 페이지 요청에서 컨트롤 상태 정보를 복원합니다.

(다음에서 상속됨 Control)
LoadViewState(Object)

SaveViewState() 메서드를 사용하여 저장된 이전 요청에서 보기 상태 정보를 복원합니다.

(다음에서 상속됨 WebControl)
MapPathSecure(String)

가상 경로(절대 또는 상대)가 매핑되는 실제 경로를 가져옵니다.

(다음에서 상속됨 Control)
MemberwiseClone()

현재 Object의 단순 복사본을 만듭니다.

(다음에서 상속됨 Object)
MergeStyle(Style)

지정된 스타일의 비어 있지 않은 요소를 웹 컨트롤에 복사하지만 컨트롤의 기존 요소를 덮어쓰지 않습니다. 이 메서드는 주로 컨트롤 개발자에 의해 사용됩니다.

(다음에서 상속됨 WebControl)
OnBubbleEvent(Object, EventArgs)

서버 컨트롤의 이벤트가 페이지의 UI 서버 컨트롤 계층 구조에 전달되었는지 여부를 확인합니다.

(다음에서 상속됨 Control)
OnDataBinding(EventArgs)

DataBinding 이벤트를 발생시킵니다.

(다음에서 상속됨 Control)
OnInit(EventArgs)

Init 이벤트를 발생시킵니다.

(다음에서 상속됨 Control)
OnLoad(EventArgs)

Load 이벤트를 발생시킵니다.

(다음에서 상속됨 Control)
OnPreRender(EventArgs)

PreRender 컨트롤에 대해 FileUpload 이벤트를 발생시킵니다.

OnUnload(EventArgs)

Unload 이벤트를 발생시킵니다.

(다음에서 상속됨 Control)
OpenFile(String)

파일을 읽는 데 사용되는 Stream을 가져옵니다.

(다음에서 상속됨 Control)
RaiseBubbleEvent(Object, EventArgs)

이벤트 소스와 해당 정보를 컨트롤의 부모 컨트롤에 할당합니다.

(다음에서 상속됨 Control)
RemovedControl(Control)

자식 컨트롤이 Control 개체의 Controls 컬렉션에서 제거된 후 호출됩니다.

(다음에서 상속됨 Control)
Render(HtmlTextWriter)

클라이언트에서 렌더링할 콘텐츠를 쓰는 지정된 HtmlTextWriter 개체에 FileUpload 컨트롤 콘텐츠를 보냅니다.

RenderBeginTag(HtmlTextWriter)

지정된 작성기에 컨트롤의 HTML 여는 태그를 렌더링합니다. 이 메서드는 주로 컨트롤 개발자에 의해 사용됩니다.

(다음에서 상속됨 WebControl)
RenderChildren(HtmlTextWriter)

클라이언트에서 렌더링될 내용을 쓰는 제공된 HtmlTextWriter 개체에 서버 컨트롤 자식의 내용을 출력합니다.

(다음에서 상속됨 Control)
RenderContents(HtmlTextWriter)

지정된 작성기에 컨트롤의 내용을 렌더링합니다. 이 메서드는 주로 컨트롤 개발자에 의해 사용됩니다.

(다음에서 상속됨 WebControl)
RenderControl(HtmlTextWriter)

제공된 HtmlTextWriter 개체로 서버 컨트롤 콘텐츠를 출력하고 추적을 사용하는 경우 컨트롤에 대한 추적 정보를 저장합니다.

(다음에서 상속됨 Control)
RenderControl(HtmlTextWriter, ControlAdapter)

제공된 HtmlTextWriter 개체를 사용하여 제공된 ControlAdapter 개체에 서버 컨트롤 콘텐츠를 출력합니다.

(다음에서 상속됨 Control)
RenderEndTag(HtmlTextWriter)

지정된 작성기에 컨트롤의 HTML 닫는 태그를 렌더링합니다. 이 메서드는 주로 컨트롤 개발자에 의해 사용됩니다.

(다음에서 상속됨 WebControl)
ResolveAdapter()

지정된 컨트롤을 렌더링하는 컨트롤 어댑터를 가져옵니다.

(다음에서 상속됨 Control)
ResolveClientUrl(String)

브라우저에 사용할 수 있는 URL을 가져옵니다.

(다음에서 상속됨 Control)
ResolveUrl(String)

URL을 요청 클라이언트에서 사용할 수 있는 URL로 변환합니다.

(다음에서 상속됨 Control)
SaveAs(String)

업로드된 파일의 내용을 웹 서버의 지정된 경로에 저장합니다.

SaveControlState()

페이지가 서버에 다시 게시된 후 발생한 서버 컨트롤 상태의 변경을 저장합니다.

(다음에서 상속됨 Control)
SaveViewState()

TrackViewState() 메서드를 호출한 후 수정된 모든 상태를 저장합니다.

(다음에서 상속됨 WebControl)
SetDesignModeState(IDictionary)

컨트롤에 대한 디자인 타임 데이터를 설정합니다.

(다음에서 상속됨 Control)
SetRenderMethodDelegate(RenderMethod)

이벤트 처리기 대리자를 할당하여 서버 컨트롤과 그 콘텐츠를 부모 컨트롤로 렌더링합니다.

(다음에서 상속됨 Control)
SetTraceData(Object, Object)

추적 데이터 키와 추적 데이터 값을 사용하여 렌더링 데이터의 디자인 타임 추적을 위한 추적 데이터를 설정합니다.

(다음에서 상속됨 Control)
SetTraceData(Object, Object, Object)

추적 개체, 추적 데이터 키와 추적 데이터 값을 사용하여 렌더링 데이터의 디자인 타임 추적을 위한 추적 데이터를 설정합니다.

(다음에서 상속됨 Control)
ToString()

현재 개체를 나타내는 문자열을 반환합니다.

(다음에서 상속됨 Object)
TrackViewState()

컨트롤이 해당 뷰 상태의 변경 내용을 추적하여 개체의 ViewState 속성에 저장할 수 있도록 합니다.

(다음에서 상속됨 WebControl)

이벤트

DataBinding

서버 컨트롤에서 데이터 소스에 바인딩할 때 발생합니다.

(다음에서 상속됨 Control)
Disposed

ASP.NET 페이지가 요청될 때 서버 컨트롤 주기의 마지막 단계로 서버 컨트롤이 메모리에서 해제될 때 발생합니다.

(다음에서 상속됨 Control)
Init

서버 컨트롤 주기의 첫 단계로 서버 컨트롤을 초기화할 때 이 이벤트가 발생합니다.

(다음에서 상속됨 Control)
Load

Page 개체에 서버 컨트롤을 로드할 때 발생합니다.

(다음에서 상속됨 Control)
PreRender

Control 개체가 로드된 후, 렌더링 전에 발생합니다.

(다음에서 상속됨 Control)
Unload

서버 컨트롤이 메모리에서 언로드될 때 발생합니다.

(다음에서 상속됨 Control)

명시적 인터페이스 구현

IAttributeAccessor.GetAttribute(String)

지정한 이름이 있는 웹 컨트롤의 특성을 가져옵니다.

(다음에서 상속됨 WebControl)
IAttributeAccessor.SetAttribute(String, String)

웹 컨트롤의 특성을 지정한 이름과 값으로 설정합니다.

(다음에서 상속됨 WebControl)
IControlBuilderAccessor.ControlBuilder

이 멤버에 대한 설명은 ControlBuilder를 참조하세요.

(다음에서 상속됨 Control)
IControlDesignerAccessor.GetDesignModeState()

이 멤버에 대한 설명은 GetDesignModeState()를 참조하세요.

(다음에서 상속됨 Control)
IControlDesignerAccessor.SetDesignModeState(IDictionary)

이 멤버에 대한 설명은 SetDesignModeState(IDictionary)를 참조하세요.

(다음에서 상속됨 Control)
IControlDesignerAccessor.SetOwnerControl(Control)

이 멤버에 대한 설명은 SetOwnerControl(Control)를 참조하세요.

(다음에서 상속됨 Control)
IControlDesignerAccessor.UserData

이 멤버에 대한 설명은 UserData를 참조하세요.

(다음에서 상속됨 Control)
IDataBindingsAccessor.DataBindings

이 멤버에 대한 설명은 DataBindings를 참조하세요.

(다음에서 상속됨 Control)
IDataBindingsAccessor.HasDataBindings

이 멤버에 대한 설명은 HasDataBindings를 참조하세요.

(다음에서 상속됨 Control)
IExpressionsAccessor.Expressions

이 멤버에 대한 설명은 Expressions를 참조하세요.

(다음에서 상속됨 Control)
IExpressionsAccessor.HasExpressions

이 멤버에 대한 설명은 HasExpressions를 참조하세요.

(다음에서 상속됨 Control)
IParserAccessor.AddParsedSubObject(Object)

이 멤버에 대한 설명은 AddParsedSubObject(Object)를 참조하세요.

(다음에서 상속됨 Control)

확장 메서드

FindDataSourceControl(Control)

지정된 컨트롤에 대한 데이터 컨트롤에 연결된 데이터 소스를 반환합니다.

FindFieldTemplate(Control, String)

지정된 컨트롤의 명명 컨테이너에서 지정된 열에 대한 필드 템플릿을 반환합니다.

FindMetaTable(Control)

상위 데이터 컨트롤에 대한 메타테이블 개체를 반환합니다.

적용 대상

추가 정보