Ivananutrition
Ivananutrition

Reputation: 56

I can't upload data from my app to dropbox

I can't upload data from my app to dropbox. I always gets this error:

 'Error in call to API function "files/upload": HTTP header "Dropbox-API-Arg": path: \'\\Songs\\539f67c172ec78e3f7608a64537616a5.mp3\' did not match pattern \'(/(.|[\\r\\n])*)|(ns:[0-9]+(/.*)?)|(id:.*)\'',

I created dropbox app, generated app access token and added token in my env file.

const uploadSong = async (file, song) => {
    const destination = path.join(process.env.DROPBOX_UPLOAD_PATH, song.asset_sound.fileNameFull);
    console.log('Uploading to DROPBOX ...', destination);
    return  await dbx.filesUpload({ path: destination, contents: file.buffer, mode: 'overwrite'});
};

Upvotes: 0

Views: 373

Answers (1)

Greg
Greg

Reputation: 16940

The path you're supplying to the path parameter of filesUpload should be the remote Dropbox path where you want to upload the file. It should be formatted like '/path/to/file.ext'.

You're supplying something like '\Songs\539f67c172ec78e3f7608a64537616a5.mp3'. I imagine you mean to supply something like '/Songs/539f67c172ec78e3f7608a64537616a5.mp3' instead.

Upvotes: 1

Related Questions