file upload failed. (API upload did not contain a file part)
Hello, I'm paul bae.
file upload frequently failed with java rest template.
not everytime. sometimes success with exactly same request(without filename).
every failed http code is "400" and message is "API upload did not contain a file part".
I don't know how to fix it.
belows are test upload fail log.
Request body: --ZCmcwgj21ZGAdw-F5nPyOHYyjoSbz64IvypjSJMc
Content-Disposition: form-data; name="attributes"
Content-Type: application/json;charset=UTF-8
{"name":"upload-test-20220806145130","parent":{"id":"164677862892"}}
--ZCmcwgj21ZGAdw-F5nPyOHYyjoSbz64IvypjSJMc
Content-Disposition: form-data; name="file"; filename="upload-test-20220806145130"
Content-Type: application/octet-stream
Content-Length: 1000
abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl
--ZCmcwgj21ZGAdw-F5nPyOHYyjoSbz64IvypjSJMc--
Response body: {"code":"bad_request","help_url":"http://developers.box.com/docs/#errors","status":400,"message":"API upload did not contain a file part","type":"error"}
-
It's 3month ago test. so I dont have example.
but it's a plain file request, not complex.
and above i said, my problem is invalid header value.
AS-IS : Content-Type: application/json;charset=UTF-8
TO-BE : Content-Type: application/json;
in my case, that's all.
I hope your issue will be resovled.
-
---1234567890Content-Disposition: form-data; name="attributes" Content-Type: application/json{"name":"test upload.txt","parent":{"id":"182678998283"}, }---1234567890Content-Disposition: form-data; name="file"; filename="test upload.txt"Content-Type: text/plainVGhpcyBpcyBhIHRlc3Q=---1234567890"
Post is closed for comments.
Comments
6 comments