I am using the following code to upload a file using PowerShell 1.0. How can I tell if the upload completed successfully or if there was an error? I need to delete the file if the upload was successful.

What I have tried:  

1. the trap clause. Cant seem to get this one to work.  

2. Checking the return value of $webclient.UploadFile -- this seems to always be an empty string, success or not 

````
$File = "D:\Dev\somefilename.zip"
$ftp = "<ftp://username:password@example.com/pub/incoming/somefilename.zip>"
````

"ftp url: $ftp"

$webclient = New-Object System.Net.WebClient
$uri = New-Object System.Uri($ftp)

"Uploading $File..."

$webclient.UploadFile($uri, $File)