Need to see if your shared folder is taking up space on your dropbox 👨💻? Find out how to check here.
Forum Discussion
Mostafa Ezzat
4 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...
- 4 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
4 years agoExplorer | Level 4
Yes Chooser Feature this's exactly what I want, but the button it doesn't working at all can I just get a demo to implement the button in my app and able to make the user login and choose the files that he wants with providing options array to this. Thanks in advance.
Greg-DB
Dropbox Community Moderator
4 years agoThe Dropbox Chooser page does include a working demo under the "Demo" section. Is that "Choose from Dropbox" button not working for you? If not, what exactly does/doesn't happen? Do you get any error message?
- Mostafa Ezzat4 years agoExplorer | 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>- Mostafa Ezzat4 years agoExplorer | Level 4
Update 1: Everything is good Sir, It works and it's fine, My only problem now is link expiring because my scenario will be I get the direct links save them in the database then get these links when it requested so if the link expires will be error so how can I make the direct link doesn't expire, and Is there any comments about this scenario, Do you think I'll face any problem in it soon while implementing along with Dropbox? Thanks in advance
Update: I did implement the button and it opens but I can't select any thing the selection button not exist. So all I just need is to get a direct link that doesn't expire at all. Thanks in advance and appreciate.
I followed this link :https://dropbox.tech/developers/quickly-integrate-file-upload-in-your-web-app-using-the-chooser - Greg-DB4 years ago
Dropbox Community Moderator
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 Ezzat4 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
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
If 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, Facebook or Instagram.
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!