Forum Discussion
Upload Files to HTTP Server Using Webproxy
- May 30, 2025
Have managed to figure this out for myself.
For anyone else that is interested it's pretty straightforward, just add the 2 lines below:-
$cred = New-Object System.Net.NetworkCredential("<username>",’<password>’)
$url = "https://some-URL.com/Test/Imports/Filename.7Z"
$input = "C:\Temp\Filename.7Z"$proxy = New-Object System.Net.WebProxy("webproxy.example.com:8080")
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$wc = New-Object System.Net.WebClient
$wc.Proxy = $proxy
$wc.Credentials = $cred
$wc.UploadFile($url, "PUT", $input)
Have managed to figure this out for myself.
For anyone else that is interested it's pretty straightforward, just add the 2 lines below:-
$cred = New-Object System.Net.NetworkCredential("<username>",’<password>’)
$url = "https://some-URL.com/Test/Imports/Filename.7Z"
$input = "C:\Temp\Filename.7Z"
$proxy = New-Object System.Net.WebProxy("webproxy.example.com:8080")
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$wc = New-Object System.Net.WebClient
$wc.Proxy = $proxy
$wc.Credentials = $cred
$wc.UploadFile($url, "PUT", $input)