Hi, i am using WebClient.UploadFile to upload a file on my web page, code:
-
WebClient webClient = new WebClient();
-
webClient.Credentials = new NetworkCredential(userName, pass);
-
webClient.UploadFile("http://www.etfos.hr/~dhuis/test.txt", @"c:\test.txt");
-
i get an error "The remote server returned an error: (404) FIle not found"
my web page is http://www.etfos.hr/~dhuis
permissions are all enabled
i tried with httpwebrequest class and i get the same error
i can upload with ftpwebrequest but then it is slow.
Any suggestions?
I'm not clear on what you are doing.
The
WebClient Class sends a local file to the resource you've specified...
The resource you've specified is:
"http://www.etfos.hr/~dhuis/test.txt"
This isn't a valid URI location to upload your file to....it cannot find "http://www.etfos.hr/~dhuis/test.txt" and so you are getting a 404 error.
Try instead:
"http://www.etfos.hr/dhuis/"
I'm not 100% sure this will work. But I am sure that you are using an invalid string to indicate the URL of the resource you want to upload the file to.
See the
WebClient.UploadFile Method for examples on how to use this.
-Frinny