I am trying to copy a file from my local to ftp, using the following code.
$ftpname = ftp://xxx/xxx/file1.txt
$localfilepath = "C:\Outbox\file1.txt"
$ftpusername = "xxx"
$ftppassword = "xx"
$client = New-Object System.Net.WebClient
$client = New-Object System.Net.WebClient
$client.Credentials = New-Object System.Net.NetworkCredential($ftpusername,$ftppassword)
return $client.UploadFile($ftpname, $localfilepath)
I am getting "UploadFile" with "2" argument(s): "An exception occurred during a WebClient request."
I am well able to access the ftp in browser via same proxy settings. Is this something to do with proxy settings ?