0

I'm using a DropBox API just for tests and I need to save some images from my WebApi, the problem is I need to have a stringPath to make the upload, but since the Bitmap image will be "stored" inside of my model, I need to create a tempFile with a unique name for that image, so I could get a path and upload the image!

This is how upload :

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);
    }
}
  • I didn't get you from your code that why do you want to have temp file – Akash KC Mar 04 '17 at 21:23
  • Because, Im using WebApi, I send an image from my AndroidClient, and then I need to send to DropBox, I cant' pass the stringPath because there's none, when I make a POST request to my API, i have something like this : `private string UserName {get;set;}` `private Bitmap ImageUser {get;set}` Here's the Image! –  Mar 04 '17 at 21:34

1 Answers1

0

You have misunderstanding on path argument for UploadAsync() method.

It's not a source path to local file that you're going to upload.

It's a destination path to remote file in user's Dropbox. See Dropbox documentation for details.

CodeFuller
  • 30,317
  • 3
  • 63
  • 79