1
Programmers corner / Upload programatically on HFS? (C#)
« on: February 15, 2015, 06:08:36 PM »
Hi...
I dont know if anyone here is a programmer, and more specifically C#, but im trying to upload a file to HFS using C# WebClient. Heres my code:
Console.Write("\nPlease enter the URI to post data to : ");
String uriString = Console.ReadLine();
// Create a new WebClient instance.
WebClient myWebClient = new WebClient();
Console.WriteLine("\nPlease enter the fully qualified path of the file to be uploaded to the URI");
string fileName = Console.ReadLine();
Console.WriteLine("Uploading {0} to {1} ...", fileName, uriString);
// Upload the file to the URI.
// The 'UploadFile(uriString,fileName)' method implicitly uses HTTP POST method.
byte[] responseArray = myWebClient.UploadFile(uriString, "POST", fileName);
// Decode and display the response.
Console.WriteLine("\nResponse Received.The contents of the file uploaded are:\n{0}",
System.Text.Encoding.ASCII.GetString(responseArray));
When i do this, the remote server returns 405 Method not allowed.
Can anyone help? Please?
I dont know if anyone here is a programmer, and more specifically C#, but im trying to upload a file to HFS using C# WebClient. Heres my code:
Console.Write("\nPlease enter the URI to post data to : ");
String uriString = Console.ReadLine();
// Create a new WebClient instance.
WebClient myWebClient = new WebClient();
Console.WriteLine("\nPlease enter the fully qualified path of the file to be uploaded to the URI");
string fileName = Console.ReadLine();
Console.WriteLine("Uploading {0} to {1} ...", fileName, uriString);
// Upload the file to the URI.
// The 'UploadFile(uriString,fileName)' method implicitly uses HTTP POST method.
byte[] responseArray = myWebClient.UploadFile(uriString, "POST", fileName);
// Decode and display the response.
Console.WriteLine("\nResponse Received.The contents of the file uploaded are:\n{0}",
System.Text.Encoding.ASCII.GetString(responseArray));
When i do this, the remote server returns 405 Method not allowed.
Can anyone help? Please?