Guidelines for self implementing chunked upload to Cloudinary

When implementing chunked upload you must comply with the following restrictions:

  1. You must include the X-Unique-Upload-Id header and make sure it's identical (and unique) for all parts.
  2. Every part must contain Content-Range header which is applicable to the location of the chunk in the overall file (Format: 'bytes #start-#end/#total', e.g. 'bytes 0-5999999/22744222').
  3. Last chunk must be last. meaning it must arrive the server after all other chunks had already returned.
  4. Each chunk must be larger than 5mb except the last one.

Here's how it's implemented within our Ruby libraries:

Have more questions? Submit a request


  • Avatar
    Han BaHwan

    How can I issue `X-Unique-Upload-Id`?
    What's Content-Range format?
    If I understand correctly, this is below:
    `Content-Range: 0-99999/2000000`
    `Content-Range: 100000-199999/2000000`
    `Content-Range: 200000-299999/2000000`

    And how can I handle errors? It looks exception can happen.

  • Avatar
    Nadav Ofir

    For `X-Unique-Upload-Id` you can use any random/unique string generator, for example Unix timestamp.
    `Content-Range` - must contain a preceding "bytes".
    Error messages (bad responses) may arise in case of upload failure. Handling it depends on your use case and the HTTP client you're using.

    Edited by Nadav Ofir
  • Avatar
    Nadav Ofir

    Han, I've just noticed that the content-range header directions were missing the necessary "bytes" prefix. This is now fixed in the above explanation.

  • Avatar
    Mohamed Habashy

    Hi Everyone,

    I think there is a additional restriction to the mentioned above by Nadav.

    "First chunk must be first. meaning it must arrive the server before any other chunks."

    Then you can do bulk upload the remaining chunk except the last as mentioned above.

    Kind regards,

    Edited by Mohamed Habashy
Powered by Zendesk