Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

126
Vistas
How can I download an image from dropbox by javaScript?

I have tried this way, but not working for me.Actually what I want is, donwload an image from dropbox and save it in a folder then show it in my UI.But I can't figure it out why this method is not working or which is the right method for downloading image from dropbox using 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 Respuestas
Responde la pregunta

0

Based on the Dropbox API URL with "/1/", I see you're attempting to call Dropbox API v1, which has been retired. You should use Dropbox API v2 instead.

For using Dropbox API v2 with JavaScript, I recommend using the official Dropbox API v2 JavaScript SDK. The README there has information and examples for installing and using it.

To download a file using that, you would use the filesDownload method.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda