Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

132
Views
¿Cómo puedo descargar una imagen de dropbox por javaScript?

Lo intenté de esta manera, pero no funcionó para mí. En realidad, lo que quiero es descargar una imagen de Dropbox y guardarla en una carpeta y luego mostrarla en mi interfaz de usuario. Pero no puedo entender por qué este método no funciona ¿O cuál es el método correcto para descargar imágenes de Dropbox usando javascript?

 // <--------------dropbox code start here-------------> let options = { success: function(files) { console.log("files", files); let imageLink = files[0].link; var array = imageLink.split("dl=0"); var splitLink=array[0]; let finalLink=splitLink+"raw=1"; console.log("Final Link",finalLink); document.getElementById("step-two-rtsp-video").style.display = "none"; document.getElementById('output').style.display = "none"; document.getElementById("take-picture-btn").style.display = "none"; const newImage = document.createElement("img"); newImage.src = finalLink; document .getElementById("uploaded-img") .appendChild(newImage); var path = files[0].name; var token = "token"; var url = "https://api-content.dropbox.com/1/files/auto/" + path; var result; var xhr = new XMLHttpRequest(); xhr.onreadystatechange = function() { if (xhr.readyState === 4 && xhr.status === 200) { result = xhr.responseText; console.log(result); } } xhr.open("GET", url, true); xhr.setRequestHeader("access_token", token); xhr.setRequestHeader("Authorization", "Bearer " + token); xhr.send(); }, cancel: function() { //optional }, linkType: "preview", // "preview" or "direct" multiselect: true, // true or false extensions: ['.png', '.jpg'], }; var button = Dropbox.createChooseButton(options); document.getElementById("selectingFileType").appendChild(button); // <--------------dropbox code end here------------->
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Según la URL de la API de Dropbox con "/1/", veo que está intentando llamar a la API de Dropbox v1, que se retiró. Debería usar Dropbox API v2 en su lugar.

Para usar Dropbox API v2 con JavaScript, recomiendo usar el SDK oficial de Dropbox API v2 JavaScript . El LÉAME allí tiene información y ejemplos para instalarlo y usarlo.

Para descargar un archivo usando eso, usaría filesDownload método de descarga de archivos.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!