Click here to Skip to main content
16,021,125 members

Comments by sujatha111 (Top 1 by date)

sujatha111 8-May-19 9:58am View    
I tried in this way also but not getting the solution.

public async Task<filemetadata> UploadFileToDropBox(string fileToUpload, string folder)
{
DropboxClient client = new DropboxClient(AccessTocken);

using (var mem = new MemoryStream(File.ReadAllBytes(fileToUpload)))
{
string filename = Path.GetFileName(fileToUpload);

try
{
string megapath = "/Dropbox/DotNetApi/DLClaim";
string megapathWithFile = Path.Combine(megapath, Path.GetFileName(Path.GetFileName(filename))).Replace("\\", "/");
var updated = client.Files.UploadAsync(megapathWithFile, WriteMode.Overwrite.Instance, body: mem);
await updated;
return updated.Result;
}
catch (Exception ex)
{
return null;
}
}
}