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);
}
}