英文:
get Dropbox file PERMANENT URL when upload
问题
var updated = await dbx.Files.UploadAsync(
folder + "/" + file,
Dropbox.Api.Files.WriteMode.Overwrite.Instance,
body: mem);
var urlHelper = await dbx.Files.GetTemporaryLinkAsync(updated.PathDisplay);
house.MainImage = urlHelper.Link;
This code is working. urlHelper.Link
give me ImageUrl but This url is temporary. After one day This url is not working.
For example: i set database this url yesterday: [Temporary URL]
This was working yesterday. But not now.
How can i get permanent URL ?
英文:
var updated = await dbx.Files.UploadAsync(
folder + "/" + file,
Dropbox.Api.Files.WriteMode.Overwrite.Instance,
body: mem);
var urlHelper = await dbx.Files.GetTemporaryLinkAsync(updated.PathDisplay);
house.MainImage = urlHelper.Link;
This code is working. urlHelper.Link
give me ImageUrl but This url is temporary. After one day This url is not working.
For example: i set database this url yesterday: https://uc278f948a5c22f08d40d0a49484.dl.dropboxusercontent.com/cd/0/get/B8u3K6GDYJZ_aliHLEpCzC8PvGZ9ERM8i9oHUAjFcbWFNK5Jjo50dg127AxfgWVozaphH6JQOvdsutWXpd0VZlCEXXWEttLjezEHQ6c87smtZxxfj8jLw1rZaqlK8P7kJnQSs1EMQ4n3YWWuYXTrN-xerpCvPiUWOZh-K_NbO0FDzlfKHsjcd9rgasGJelzIjnw/file
This was working yesterday. But not now.
How can i get permanent URL ?
答案1
得分: 1
如您所发现,GetTemporaryLinkAsync
返回的链接并不是永久的,只在几小时内有效。
如果您需要一个永不过期的链接,可以使用 CreateSharedLinkWithSettingsAsync
。请注意,该方法返回的共享链接默认指向 HTML 预览页面,而不是文件内容。但您可以根据此处的文档修改这些链接以直接访问文件内容。
英文:
As you found, the links returned by GetTemporaryLinkAsync
are not permanent and are only valid for a few hours.
If you need a non-expiring link, you can use CreateSharedLinkWithSettingsAsync
instead. Note that the shared links returned by that method point to an HTML preview page by default and not the file content. You can modify those links for direct file content access as documented here though.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论