I have created a Test folder on my Google Drive. I want to upload files in this folder using the google drive hard-coded URL. Anyone can access this folder and anyone can add and delete files because I have provided full access to this folder. But the system throws an error "the remote server returned an error (400) bad request" on the UploadFile request. Below is my code. Please help to resolve the issue. Thanks
private void Upload(string fileName) { var client = new WebClient();
var uri = new Uri("https://drive.google.com/drive/folders/1yPkWZf03yhihjkejQYrhuS_SMxh9j8AP?usp=sharing");
try
{
client.Encoding = Encoding.UTF8;
client.UploadFile(uri, fileName);
//client.Headers.Add("fileName", Path.GetFileName(fileName));
//var data = File.ReadAllBytes(fileName);
//client.UploadDataAsync(uri, data);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}