Hi
Using the below code for uplaoding a file through API in c#. Getting the error : Invalid URL!!.
Please let me know what correction is required to upload a file successfully.
public async Task<string> UploadFile()
{
var retunVal = "";
using (HttpClient httpClient = new HttpClient())
{
{
request.Properties.Add("filename", "Untitled.jpg");
using (FileStream fstream = File.Open(@"C:\Users\jharikrishna\Desktop\Untitled.jpg", FileMode.Open))
{
request.Properties.Add("content", fstream);
retunVal = await (await httpClient.SendAsync(request)).Content.ReadAsStringAsync();
}
}
}
return retunVal;
}
Note: Have also tried tried passing bytearray instead of stream for the content parameter value. The result is the same.