Your workflow is unique 👨💻 - tell us how you use Dropbox here.
Forum Discussion
Vivek S.3
9 years agoNew member | Level 2
File Naming
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_f...
- 9 years ago
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.
Vivek S.3
9 years agoNew member | Level 2
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?
Steve M.
Dropbox Staff
9 years agoI 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);
});- Vivek S.39 years agoNew member | Level 2
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.
- Steve M.9 years ago
Dropbox Staff
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.
- Vivek S.39 years agoNew member | Level 2
Steve,
Thanks. That makes sense.
Vivek
About Dropbox API Support and Feedback
Get help with the Dropbox API from fellow developers and experts.
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.
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!