I\'m using the new Dropbox SDK v2 for .NET.
I\'m trying to upload a document to a Dropbox account.
public async Task UploadDoc()
{
using
You can use the following method if you just want to upload a file with a given path:
private async Task Upload(DropboxClient dbx, string folder, string file, string fileToUpload)
{
using (var mem = new MemoryStream(File.ReadAllBytes(fileToUpload)))
{
var updated = await dbx.Files.UploadAsync(
folder + "/" + file,
WriteMode.Overwrite.Instance,
body: mem);
Console.WriteLine("Saved {0}/{1} rev {2}", folder, file, updated.Rev);
}
}
Parameter example:
folder = "/YourDropboxFolderName";
file = "fileName.pdf";
fileToUpload = @"C:\Users\YourUserName\fileName.pdf";