Error Uploading File exceding 1MB

Go to solution
New Contributor

Error Uploading File exceding 1MB

Using the box API, I am trying to upload a file using the curl


curl -X POST \
     -H 'Authorization: Bearer <ACCESS_TOKEN>" '
     -H "Content-Type: multipart/form-data" \
     -F attributes='{"name":"Photo.jpg", "parent":{"id":"11446498"}}' \
     -F file=@<FILE_NAME>


I am receiving the following error:


{"code":"bad_request","help_url":"","status":400,"message":"non-file POST form-data field exceeds set limit of 1000000 bytes"}


 Why does it say that the limit is 1MB?

In the box api documentation says that the file has to be less than 50MB and my file has about 5MB


Tags (3)
Box Employee

Re: Error Uploading File exceding 1MB

Hi @danielrod99 I just gave this a test as well and it seems to work fine:


curl -X POST \
     -H 'Authorization: Bearer hXLolSiUKjMSA9CBDwpIcYU23y0XMr6e' \
     -H "Content-Type: multipart/form-data" \
     -F attributes='{"name":"File.pdf", "parent":{"id":"0"}}' \
     -F file=@file.pdf


I did notice that your code had an extra double-quote in the Authorization header at the end. This might have caused some weirdness to occur.


Also, it seems the error does not seem to point at an issue with the file size being too large, but with the non-file data (the attributes field). Can you please retry and verify the full command you used?

Developer Advocate @ Box