0

I'm successfully uploading a new document by specifying its name and its content but is that possible to actually pass the document itself?

async Task Upload(DropboxClient dbx, string folder, string file, string content)
{
    using (var mem = new MemoryStream(Encoding.UTF8.GetBytes(content)))
    {
        var updated = await dbx.Files.UploadAsync(
            folder + "/" + file,
            WriteMode.Overwrite.Instance,
            body: mem);

        Console.WriteLine("Saved {0}/{1} rev {2}", folder, file, updated.Rev);
    }
}
user3378165
  • 6,546
  • 17
  • 62
  • 101
  • Looks like it yes: var file = api.UploadFile("dropbox", "photo.jpg", @"C:\Pictures\photo.jpg"); More info here : http://stackoverflow.com/questions/17699031/upload-files-to-a-specific-folder-in-dropbox – Fuzzybear Dec 05 '16 at 11:38
  • Thank you, but I'm talking about the new Dropbox sdk for .net so this question is not relevant for me.. – user3378165 Dec 05 '16 at 11:44
  • [Check the api sample, To upload a file:](https://blogs.dropbox.com/developers/2015/06/introducing-a-preview-of-the-new-dropbox-net-sdk-for-api-v2/) – huse.ckr Dec 05 '16 at 12:03
  • The code that I have posted above is from there. – user3378165 Dec 05 '16 at 12:53
  • [Cross-linking for reference: https://www.dropboxforum.com/t5/API-support/Upload-a-file-with-a-given-path/m-p/196538#M9005 ] – Greg Dec 05 '16 at 21:49

0 Answers0