Trying to upload a document via PUT, getting error request_too_large/ Error Message: File is too large

Good afternoon,

I'm trying to set up a PHP script to do an import of files into Sugar and I'm running into an issue when trying to use the /Documents/:document_id/file/:file_name endpoint. I'm sending over my base64 encoded string ('test') as the contents of the file with an oauth-token header and 'X-Content-Transfer-Encoding' of 'base64', but Sugar is responding with:

{
"error": "request_too_large",
"error_message": "File is too large"
}
I've checked both the php.ini and sugar config and they both have fairly large limits set, so I'm stumped as to why Sugar thinks it can't accept this file and the API docs are unfortunately barren about doing this kind of operation.

Does anyone have some insight into how this is supposed to work and/or how I can post the contents of a file over to the API so it gets written into the system?
  • did you check I don't know how big is the files that you need to upload but check this as well

    upload_max_filesize = {size}
    post_max_size = {size}


    Rodrigo Manara

    Sr. Developer

  • Thanks for your reply Rodrigo, it actually turns out that when you send a base64 encoded string via the API, there is a problem with one of the methods, $this->checkPutRequestBody($filesize);, that isn't working correctly. The approved fix via the Sugar team is to comment out that line and then it will work.