Showing results for 
Show  only  | Search instead for 
Did you mean: 
Want to learn some quick and useful tips to make your day easier? Check out how Calvin uses Replay to get feedback from other teams at Dropbox here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

Showing results for 
Show  only  | Search instead for 
Did you mean: 

Re: Upload a file with a given path

Upload a file with a given path

Explorer | Level 3


m using the new Dropbox SDK v2 for .NET.

I'm trying to upload a document to a Dropbox account.

public async Task UploadDoc()
(var dbx = new DropboxClient("XXXXXXXXXX")) { var full = await dbx.Users.GetCurrentAccountAsync();
await Upload(dbx, @"/MyApp/test", "test.txt","Testing!"); } }
async Task Upload(DropboxClient dbx, string folder, string file, string content) {
(var mem = new MemoryStream(Encoding.UTF8.GetBytes(content))) { var updated = await dbx.Files.UploadAsync(
+ "/" + file, WriteMode.Overwrite.Instance,
body: mem); Console.WriteLine("Saved {0}/{1} rev {2}", folder, file, updated.Rev); } }

This code snippet actually creates a test.txt document on the Dropbox account with the "Testing!" content, but I want to upload a document, with a given path (for example: "C:\MyDocuments\test.txt"), is that possible?

Any help would be very much appreciated.

2 Replies 2

Super User II
*moves to API forum*


:penguin::penguin: - :penguin: - :penguin: - :penguin:

Heart Did this post help you? If so please mark it for some Kudos below. 

:white_check_mark: Did this post fix your issue/answer your question? If so please press the 'Accept as Solution' button to help others find it.

:arrows_counterclockwise: Did this post not resolve your issue? If so please give us some more information so we can try and help - please remember we cannot see over your shoulder so be as descriptive as possible! 


Dropbox Staff
Need more support?