ASP.NET MVC How to upload file to dropbox and return file url
I making MVC website. I would like to use dropbox for storing my files. I find some code hove to upload files but I have no idea how to return back file url. How to upload file to dropbox and return uploaded file url to save in db?
My code:
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);
}
}
Comments
Post a Comment