cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to learn some quick and useful tips to make your day easier? Check out how Calvin uses Replay to get feedback from other teams at Dropbox here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

File Naming

File Naming

Vivek S.3
New member | Level 2
Go to solution

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?

1 Accepted Solution

Accepted Solutions

Steve M.
Dropbox Staff
Go to solution

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.

View solution in original post

5 Replies 5

Vivek S.3
New member | Level 2
Go to solution

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
Go to solution

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); });

Vivek S.3
New member | Level 2
Go to solution

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.
Dropbox Staff
Go to solution

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
New member | Level 2
Go to solution

Steve,

 

Thanks. That makes sense. 

 

Vivek

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Vivek S.3 New member | Level 2
  • User avatar
    Steve M. Dropbox Staff
What do Dropbox user levels mean?