简体   繁体   English

如何在ASP.NET中获取Dropbox上传的图像的URL

[英]How to get the URL of Dropbox uploaded image in ASP.NET

I have written a small method that uploads files on Dropbox and that method is working absolutely fine but the issue is how can I get the URL of the uploaded image so that I hit that URL on browser and it shows me the image. 我写了一个小方法,可以在Dropbox上上传文件,该方法绝对可以正常工作,但是问题是如何获取上载图像的URL,以便在浏览器中单击该URL并向我显示图像。 Here is the code of uploading files: 这是上传文件的代码:

 public static async Task Run()
        {
            var accessToken = ConfigurationManager.AppSettings["DropBoxAccessToken"];
            using (var dbx = new DropboxClient(accessToken))
            {
                //var full = await dbx.Users.GetCurrentAccountAsync();
                await Upload(dbx, "/Test", "Test Image.jpg");
            }
        }

        static async Task Upload(DropboxClient dbx, string folder, string file)
        {
            var readContent = System.IO.File.ReadAllBytes(@"D:\Images\IMG_20161127_204200968.jpg");
            using (var mem = new MemoryStream(readContent))
            {
                var updated = await dbx.Files.UploadAsync(
                    folder + "/" + file,
                    WriteMode.Overwrite.Instance,
                    body: mem);
                var mediaInfo = updated.MediaInfo;
            }
        }

I have tried to get details of uploaded image by hovering on var updated but didn't get the URL. 我试图通过将鼠标悬停在已更新的var上来获取上载图像的详细信息,但未获取URL。

Any help? 有什么帮助吗?

To get a link to a file via the Dropbox API, you have two options: 要通过Dropbox API链接到文件,您有两个选择:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM