UploadFileCompletedEventArgs 클래스

정의

UploadFileCompleted 이벤트에 대한 데이터를 제공합니다.

public ref class UploadFileCompletedEventArgs : System::ComponentModel::AsyncCompletedEventArgs
public class UploadFileCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs
type UploadFileCompletedEventArgs = class
    inherit AsyncCompletedEventArgs
Public Class UploadFileCompletedEventArgs
Inherits AsyncCompletedEventArgs
상속
UploadFileCompletedEventArgs

예제

다음 코드 예제에서는 파일을 비동기적으로 업로드하는 방법을 보여 줍니다.

// Sample call: UploadFileInBackground2("http://www.contoso.com/fileUpload.aspx", "data.txt")
void UploadFileInBackground2( String^ address, String^ fileName )
{
   WebClient^ client = gcnew WebClient;
   Uri ^uri = gcnew Uri(address);

   client->UploadFileCompleted +=
     gcnew UploadFileCompletedEventHandler (UploadFileCallback2);

   // Specify a progress notification handler.
   client->UploadProgressChanged +=
       gcnew UploadProgressChangedEventHandler( UploadProgressCallback );
   client->UploadFileAsync( uri, "POST", fileName );
   Console::WriteLine( "File upload started." );
}
// Sample call: UploadFileInBackground2("http://www.contoso.com/fileUpload.aspx", "data.txt")
public static void UploadFileInBackground2(string address, string fileName)
{
    WebClient client = new WebClient();
    Uri uri = new Uri(address);

    client.UploadFileCompleted += new UploadFileCompletedEventHandler(UploadFileCallback2);

    // Specify a progress notification handler.
    client.UploadProgressChanged += new UploadProgressChangedEventHandler(UploadProgressCallback);
    client.UploadFileAsync(uri, "POST", fileName);
    Console.WriteLine("File upload started.");
}
'  Sample call: UploadFileInBackground2("http:' www.contoso.com/fileUpload.aspx", "data.txt")
Public Shared Sub UploadFileInBackground2(ByVal address As String, ByVal fileName As String)

    Dim client As WebClient = New WebClient()
                Dim uri as Uri =  New Uri(address)
    AddHandler client.UploadFileCompleted, AddressOf UploadFileCallback2

    '  Specify a progress notification handler.
    AddHandler client.UploadProgressChanged, AddressOf UploadProgressCallback
    client.UploadFileAsync(uri, "POST", fileName)
    Console.WriteLine("File upload started.")
End Sub

다음 메서드는 업로드가 완료 되 면 호출 됩니다.

void UploadFileCallback2( Object^ /*sender*/, UploadFileCompletedEventArgs^ e )
{
   String^ reply = System::Text::Encoding::UTF8->GetString( e->Result );
   Console::WriteLine( reply );
}
private static void UploadFileCallback2(Object sender, UploadFileCompletedEventArgs e)
{
    string reply = System.Text.Encoding.UTF8.GetString(e.Result);
    Console.WriteLine(reply);
}
Private Shared Sub UploadFileCallback2(ByVal sender As Object, ByVal e As System.Net.UploadFileCompletedEventArgs)

    Dim reply As String = System.Text.Encoding.UTF8.GetString(e.Result)
    Console.WriteLine(reply)
End Sub

설명

이 클래스의 인스턴스를 전달 되는 UploadFileCompletedEventHandler합니다.

속성

Cancelled

비동기 작업이 취소되었는지 여부를 나타내는 값을 가져옵니다.

(다음에서 상속됨 AsyncCompletedEventArgs)
Error

비동기 작업 중 발생한 오류를 나타내는 값을 가져옵니다.

(다음에서 상속됨 AsyncCompletedEventArgs)
Result

UploadFileAsync 메서드를 호출하여 시작된 데이터 업로드 작업에 대한 서버 회신을 가져옵니다.

UserState

비동기 작업의 고유 식별자를 가져옵니다.

(다음에서 상속됨 AsyncCompletedEventArgs)

메서드

Equals(Object)

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

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

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

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

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

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

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

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

비동기 작업에 실패한 경우 사용자가 제공한 예외를 발생시킵니다.

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

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

(다음에서 상속됨 Object)

적용 대상