A: 

The UploadFile method is synchronous. If it completes without throwing an exception, you have had success. You should get a trappable WebException if it fails.

http://msdn.microsoft.com/en-us/library/36s52zhs.aspx

I'll leave out details about error trapping, as it appears you are familiar with it already.

kbrimington
Any example of error trapping would be helpful. I have tried trap[Exception]{$failed = "true"} but keep getting errors that Powershell does not recognize trap as a cmd-let
Adam Lerman
Here's a page with some good examples. Note that they do their trapping within the function containing (pardon the pun) exceptionable code, and place the trap logic first. I hope this helps.http://huddledmasses.org/trap-exception-in-powershell/
kbrimington
+1  A: 

Drop the trap down into a new scope so that you trap on the exception thrown by Upload e.g.:

$succeeded = $true;
& {
    trap { $script:succeeded = $false; continue }
    $webclient.UploadFile($uri, $File)
}
if ($succeeded) { 'Yay!' } else { 'Doh!' }

You could also try to catch a specific exception like so:

trap [System.Net.WebException] { ... }
Keith Hill