WebClient.UploadFileCompleted WebClient.UploadFileCompleted WebClient.UploadFileCompleted WebClient.UploadFileCompleted Event

Definition

Tritt ein, wenn ein asynchroner Dateiupload abgeschlossen wird.Occurs when an asynchronous file-upload operation completes.

public:
 event System::Net::UploadFileCompletedEventHandler ^ UploadFileCompleted;
public event System.Net.UploadFileCompletedEventHandler UploadFileCompleted;
member this.UploadFileCompleted : System.Net.UploadFileCompletedEventHandler 
Public Custom Event UploadFileCompleted As UploadFileCompletedEventHandler 

Beispiele

Im folgenden Codebeispiel wird das Festlegen eines Ereignis Handlers für dieses Ereignis veranschaulicht.The following code example demonstrates setting an event handler for this event.

// 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

Hinweise

Dieses Ereignis wird jedes Mal ausgelöst, wenn ein asynchroner dateiuploadvorgang abgeschlossen ist.This event is raised each time an asynchronous file upload operation completes. Asynchrone Datei Uploads werden gestartet, indem die UploadFileAsync -Methoden aufgerufen werden.Asynchronous file uploads are started by calling the UploadFileAsync methods.

Der UploadFileCompletedEventHandler ist der Delegat für dieses Ereignis.The UploadFileCompletedEventHandler is the delegate for this event. Die UploadFileCompletedEventArgs -Klasse stellt den Ereignishandler für Ereignisdaten bereit.The UploadFileCompletedEventArgs class provides the event handler with event data.

Weitere Informationen zum Behandeln von Ereignissen finden Sie unter behandeln und Auslösen von Ereignissen.For more information about how to handle events, see Handling and Raising Events.

Gilt für: