Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8884803
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T21:09:06+00:00 2026-06-14T21:09:06+00:00

ORIGINAL I’m having problems to upload a file (image) to Dropbox from Node.js using

  • 0

ORIGINAL

I’m having problems to upload a file (image) to Dropbox from Node.js using the official dropbox.js.
I want to upload a picture that I have in another server. For example with the dropbpox icon (www.dropbox.com/static/images/new_logo.png).

client.writeFile(file, 'www.dropbox.com/static/images/new_logo.png', function(error, stat) {
 if (error) {
  return es.send(error.status);  // Something went wrong.
 }

 res.send("File saved as revision " + stat.revisionTag);
});

I know that this only creates a text file with the url, but how I can upload the picture to Dropbox?
I also try to download the file using http.get and then upload this to dropbox but it doesn’t work.

Thanks.

UPDATE WITH MORE INFO

First I download the image from a remote url with this code:

var request = http.get(options, function(res){
        var imagedata = ''
        res.setEncoding('binary')

        res.on('data', function(chunk){
            imagedata += chunk
        }) 

        res.on('end', function(){ 
            console.log("Image downloaded!");

            fs.writeFile(local, imagedata, 'binary', function(err){
              if (err) throw err
              console.log('File saved.')
            })
        })
    })

The file is saved correctly.
Then I trie to things:

Sending the ‘imagedata’ to Dropbox:

  console.log("Image downloaded!");

            client.writeFile(file, imagedata, function(error, stat) {
                if (error) {
                    return response.send(error.status);  // Something went wrong.
                }

                response.send("File saved as revision " + stat.revisionTag);
            });

And something is uploaded to Dropbox but it’s nothing useful.

Then I also tried to read the file from disc and then send it to Dropbox but it doesn’t work neither:

fs.readFile(file, function(err, data) {
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T21:09:07+00:00Added an answer on June 14, 2026 at 9:09 pm

    Use dropbox-js 0.9.1-beta1 or above to upload binary files from node.js. You need to pass it Buffer or ArrayBuffer instances. Try this code:

    var req = http.get(options, function(res) {
      var chunks = [];
    
      res.on('data', function(chunk) {
        chunks.push(chunk);
      });
    
      res.on('end', function() {
        console.log("Image downloaded!");
    
        var imageData = Buffer.concat(chunks);
        client.writeFile(file, imageData, function(error, stat) {
          if (error) {
            return response.send(error.status);
          }
          response.send("File saved as revision " + stat.revisionTag);
        });
      });
    });
    

    “`

    Original answer: the dropbox-js README mentions that binary files don’t work in node.js just yet.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Original question: Note: Below plugin pattern based on the official jQuery docs . I'm
original string is a,d,k I want to remove all , and make it to
ORIGINAL (see UPDATED QUESTION below) I am designing a new laboratory database that tests
Original Question: i read that for RESTful websites. it is not good to use
Original Problem: I have 3 boxes each containing 200 coins, given that there is
Original Problem In building our projects, I want the mercurial id of each repository
// Original // I want to call this guy -(void)addFavorite:(NSString *)favoriteToAdd at, @selector here
Original question changed. I want to bitwise turn off the left most bit of
Original Question I want to be able to generate a new (fully valid) MP3
Original Question I am looking for a function that attempts to quantify how distant

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.