Your workflow is unique 👨‍💻 -  tell us how you use Dropbox here.

Forum Discussion

Akshata G.'s avatar
Akshata G.
Helpful | Level 5
9 years ago

API fails to autorename the files with large file size

Hi,

I am facing issue with autorenaming of uploaded files. The API fails to autorename the files with large file size where as the smaller files are getting renamed properly.

Details of the issue are as follows: 

I am Trying to Upload a file of size 606KB which has been uploaded previously through Postman with following inputs:

Uri : https://content.dropboxapi.com/2/files/upload

Dropbox-API-Arg : {"path":"/test/modified.jpg","mode":"add","autorename":true,"mute":false}

Content-Type : application/octet-stream

The API returns a 200 OK response. However, in the response it gives  the name as 'modified.jpg' again!. Where ideally it should have been  modified(1).jpg.

Where as when i tried uploading a file with size 12.3KB it returned a response successfully as modified(1).jpg.

Any pointers on this would be of great help..

 

Thanks in advance,

Akshata

5 Replies

Replies have been turned off for this discussion
  • Steve M.'s avatar
    Steve M.
    Icon for Dropbox Staff rankDropbox Staff
    9 years ago

    Akshata, are you by chance uploading the exact same file content? If the content is unchanged, Dropbox essentially ignores the update, so the file doesn't get renamed. Make sure that you're uploading different content to test that rename works properly.

  • Akshata G.'s avatar
    Akshata G.
    Helpful | Level 5
    9 years ago

    HI Steve,

    Thanks for the reply!.. Yes I was uploading the same file content and it worked after changing the content. But files with small size(12KB) are still getting renamed without any change in content.. Is it the expected behaviour for upload ?

     

    Thanks in advance,

    Akshata

  • Steve M.'s avatar
    Steve M.
    Icon for Dropbox Staff rankDropbox Staff
    9 years ago

    Akshata, no, the expected behavior is that files of all sizes work the same way. That said, I'm unable to reproduce the issue with a 13-byte file. When I try it, the file remains unchanged and not renamed:

    $ echo Hello, World | http post https://content.dropboxapi.com/2/files/upload Dropbox-Api-Arg:'{"path": "/test", "mode": "add", "autorename": true}' Content-Type:application/octet-stream Authorization:'Bearer <REDACTED>'

    HTTP/1.1 200 OK
    ...
    Date: Fri, 27 May 2016 04:34:27 GMT

    {
        ...
        "name": "test",
        "path_display": "/test",
        "path_lower": "/test",
        "server_modified": "2016-05-27T04:34:27Z",
        "size": 13
    }

    $ echo Hello, World | http post https://content.dropboxapi.com/2/files/upload Dropbox-Api-Arg:'{"path": "/test", "mode": "add", "autorename": true}' Content-Type:application/octet-stream Authorization:'Bearer <REDACTED>'

    HTTP/1.1 200 OK
    ...
    Date: Fri, 27 May 2016 04:34:33 GMT

    {
        ...
        "name": "test",
        "path_display": "/test",
        "path_lower": "/test",
        "server_modified": "2016-05-27T04:34:27Z",
        "size": 13
    }

    Please double check that you're actually sending the same data both times.

  • Akshata G.'s avatar
    Akshata G.
    Helpful | Level 5
    9 years ago

    Hi Steve,

    Thanks for the reply..

    I tried to upload a text file of 10 bytes this time, still the i was able to get a response with proper autorenaming. I tried this on postman, and both the times i directly hit send request button without changing anything, and still received a autorenamed responses.

    Following are snap shots of responses:

    First response:

    Second response:

    Please let me know if I am missing on anything..

     

    Thanks,

    Akshata

  • Steve M.'s avatar
    Steve M.
    Icon for Dropbox Staff rankDropbox Staff
    9 years ago

    My guess would be that you have a "path" arg of "modified.jpg", and the contents of that file are not the same as the contents of "new.txt" (the file you're uploading).

    Each time you make this API call, the contents of "new.txt" still don't match the original "modified.jpg", so there's a conflict and your upload gets renamed. The rename won't happen if you're uploading content that's identical to what's already at the target path.

About Dropbox API Support and Feedback

Node avatar for 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!