Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
Hi,
I'm using the nodejs SDK and I notice that when using the filesUpload method, file names seem to be get clipped short. For example, I have a file that is uploaded to the path -
/test/some_folder/This Is A Test File - 123456 - 09/23/2016 - blah - blah.pdf
When I go into the dropbox explorer UI I see - /test/some_folder/2016 - blah - blah.pdf
Is there a a way to prevent this name-shortening?
Oh, it looks like things are working correctly then.
A forward slash is the path separator, so the path /foo/bar/baz means a file named "baz" in a folder called "bar" within a folder called "foo".
The path you're passing has six slashes, and it seems like you expect four of them to be path separators and two of them to not be. How would Dropbox know which were which?
https://www.dropbox.com/help/145 may help. It goes over some of the restrictions in characters that make up paths in Dropbox.
Okay, I think it's the slashes. I replaced them with hyphens and it seemed to work. The question now is, how do I get forward slashes into the filenames?
I can't reproduce the issue. Could you share your code? For reference, here is the code I used that worked successfully. (The file was in the expected location as observed on dropbox.com.)
const Dropbox = require('dropbox'); const dbx = new Dropbox({ accessToken: '<REDACTED>' }); dbx.filesUpload({
path: '/test/some_folder/This Is A Test File - 123456 - 09/23/2016 - blah - blah.pdf',
contents: "Hello, World!"
}).then((response) => { console.log(response); }).catch((error) => { console.log(error); });
Hi Steve,
Here is my code -
let dropboxConnector = require('./connectors/dropbox_connector'); // This is my dbx instance with the token. dropboxConnector.filesUpload({ contents: "Test", path: '/dev/test/test_folder/test name - 1234 - xof - 12/12/2016 - test', mute: true, }).then((res) => { console.log(res); });
I just re-ran this and what ends up happening here is I get a folder structure (indicated by >) like this on dropbox -
dev > test > test_folder > test name - 1234 - xof - 12 > 12 > 2016 - test
with 2016 - test being written as the filename and test name - 1234 - xof - 12 being written as a folder.
My expectation is -
dev > test > test_folder > test name - 1234 - xof -12/12/2016 - test
with "test name - 1234 - xof -12/12/2016 - test" being the file name.
Oh, it looks like things are working correctly then.
A forward slash is the path separator, so the path /foo/bar/baz means a file named "baz" in a folder called "bar" within a folder called "foo".
The path you're passing has six slashes, and it seems like you expect four of them to be path separators and two of them to not be. How would Dropbox know which were which?
https://www.dropbox.com/help/145 may help. It goes over some of the restrictions in characters that make up paths in Dropbox.
Steve,
Thanks. That makes sense.
Vivek
Hi there!
If you need more help you can view your support options (expected response time for a ticket is 24 hours), or contact us on X or Facebook.
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!