We are aware of the issue with the badge emails resending to everyone, we apologise for the inconvenience - learn more here.
Forum Discussion
Mostafa Ezzat
3 years agoExplorer | Level 4
Displaying file from Dropbox into a WebApplication using Dropbox API
Hello, I want to find the best way to view a file like a video or image from Dropbox into a Website using HTTP or Javascript SDK
for example I'm trying at least to download a file using t...
- 3 years ago
Unfortunately, the Dropbox Chooser does not have an option for retrieving "direct" links that do not expire, but I'll pass this along as a feature request. I can't promise if or when that might be implemented though. As a workaround, you can use "preview" links, which don't expire, and modify them for direct access as documented here.
Also, regarding the issue with the files being disabled, looking at your code, it seems the issue here is that you're setting sizeLimit: 1024, which is limiting the user to selecting only relatively small files. Please try removing that option and you should see larger files selectable.
Mostafa Ezzat
Explorer | Level 4
This's my code I added the js lib of Dropbox, Do I miss something else? but the button it doesn't appear
I also have only one issue can I make the direct link doesn't expire because my scenario will be the user will choose the videos or images, Then I get the direct link and that will be previewed in the application that if anybody wants to watch the video or the image but the link expires.
<html>
<head>
<script type="text/javascript" src="https://www.dropbox.com/static/api/2/dropins.js" id="dropboxjs" data-app-key="2hver24zt8u8zdv"></script>
</head>
<body>
<video controls autoplay width="620" type="video/mp4">
<source src="https://dl.dropboxusercontent.com/1/view/dcllqru2ajomsqn/Hi/Kyri%20SEO%20-%2016%20April%202022.mp4" type="video/mp4">
</video>
<script type="text/javascript">
options = {
// Required. Called when a user selects an item in the Chooser.
success: function(files) {
alert("Here's the file link: " + files[0].link)
},
// Optional. Called when the user closes the dialog without selecting a file
// and does not include any parameters.
cancel: function() {
},
// Optional. "preview" (default) is a preview link to the document for sharing,
// "direct" is an expiring link to download the contents of the file. For more
// information about link types, see Link types below.
linkType: "direct", // or "direct"
// Optional. A value of false (default) limits selection to a single file, while
// true enables multiple file selection.
multiselect: true, // or true
// Optional. This is a list of file extensions. If specified, the user will
// only be able to select files with these extensions. You may also specify
// file types, such as "video" or "images" in the list. For more information,
// see File types below. By default, all extensions are allowed.
extensions: ['.pdf', '.doc', '.docx', '.mp4'],
// Optional. A value of false (default) limits selection to files,
// while true allows the user to select both folders and files.
// You cannot specify `linkType: "direct"` when using `folderselect: true`.
folderselect: true, // or true
// Optional. A limit on the size of each file that may be selected, in bytes.
// If specified, the user will only be able to select files with size
// less than or equal to this limit .
// For the purposes of this option, folders have size zero.
sizeLimit: 1024, // or any positive number
};
var button = Dropbox.createChooseButton(options);
document.getElementById("container").appendChild(button);
</script>
</html>
Greg-DB
3 years agoDropbox Staff
Unfortunately, the Dropbox Chooser does not have an option for retrieving "direct" links that do not expire, but I'll pass this along as a feature request. I can't promise if or when that might be implemented though. As a workaround, you can use "preview" links, which don't expire, and modify them for direct access as documented here.
Also, regarding the issue with the files being disabled, looking at your code, it seems the issue here is that you're setting sizeLimit: 1024, which is limiting the user to selecting only relatively small files. Please try removing that option and you should see larger files selectable.
- Mostafa Ezzat3 years agoExplorer | Level 4
Can I ask one last question, Please.
Can I add any parameters to options array here to get the directory name, the normal options response I get the name of the file, So I need also the name of the folder, sharing_get_shared_link_metadata I'm thinking of using this if it's not possible to do the previous one but it will request additional requests for sure. Thanks in advance - Greg-DB3 years agoDropbox Staff
No, the Dropbox Chooser does not offer an option for getting the name of the parent directory of the selected file. You can find all of the available options in the Chooser documentation.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,877 PostsLatest Activity: 12 months agoIf you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X or Facebook.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!