I need to upload files from one site to another and I thought about using the WebClient class and FileUpload method from the System.Net namespace. I read the MSDN documentation and it seems an easy task to achieve but something is going on wrong. For now, I am only testing with the following simple code to upload a file to a test web server in our office which uses HTTP port 8080 instead of 80:
Protected Sub btnSubeFotosChicas_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubeFotosChicas.Click Dim objWebClient As WebClient = New WebClient() objWebClient.UploadFile("http://192.168.1.1:8080/losajos/fotos/getmap.jpg", "d:\temp\getmap.jpg") End Sub
The code above issues the following exception:
"The remote server returned an error: (404) No Found."
I have made sure that both paths are correct.
Also, does the UploadFile method saves the file physically in the hard disk (I suppose so) or does it load it into the server's memory?
I have read several posts here and there but I am getting more confused so I will very much appreciate your kind advice as detailed as possible.
View Complete Post