Chunk Uploading on REST API failed with the error message "X-Cld-Error: Chunk size doesn't match upload size: 10240000 - 36592771"
I tried to implement a sample of Chunk Uploading on REST API.
I ran into the error "X-Cld-Error: Chunk size doesn't match upload size: 10240000 - 36592771".
I understand this means the binary file which I send has wrong size somehow.
But, I could not find my mistake in my source code.
```
# Information
cloud_name: NOIAB
the Request
Host: api.cloudinary.com
Connection: keep-alive
Content-Length: 36593362
Content-Range: bytes 0-10239999/26789510
Accept: application/json, text/plain, */*
X-Unique-Upload-Id: 1590740923
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36
Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryIB9FeoYI9xJ0kAWI
Origin: http://localhost:8080
Sec-Fetch-Site: cross-site
Sec-Fetch-Mode: cors
Sec-Fetch-Dest: empty
Referer: http://localhost:8080/
Accept-Encoding: gzip, deflate, br
Accept-Language: ja,en-US;q=0.9,en;q=0.8
-
Hi Joel,
The issue was that the chunked upload request being made was not quite right in terms of the values passed as part of the Content-Range header. In this case, the entire file was being sent but the Content-Range header says that a 10MB chunk was to be expected.
Please see the following example JSFiddle that has a working chunked-upload solution in pure JavaScript:
https://jsfiddle.net/leptians/hLajmbpf/If you're running into any issues please share more details such as your code and the exact error message from the API and we can assist.
Please sign in to leave a comment.
Comments
3 comments