Invalid file reference on Notes upload

OS: Linux Ubuntu 18.04, php 7.2, SuiteCRM Version 7.11.8, web server - Apache, database mysql

When I try to post a Note by SuiteCRM api, and after I try to download the created note, I get a “invalid file reference” every time, but when I do it on the page everything is okay and the Note gets created.

Also, my suitecrm/upload folder has 777 permissions, still doesn’t work, it doesn’t even create a Note there when I do it in the api.

My post request body looks like this:

$newFile = new CURLFile($path, $mtype, $filename);
$contents = file_get_contents($path);
$content_array = array(
			"data" =>array(
				"type" => "Notes",
				"attributes" => array(
					"name" => "Call Recording",
					"parent_type" => "Calls",
					"contact_id" => "ad4e463c-f3db-201d-bdad-5daea765550a",
					"parent_id" => $calldata->calllogid,
					"portal_flag" => false,
					"filename" => $newFile->name,
					"file" => base64_encode($contents),
					"file_mime_type" => $newFile->mime

The endpoint I’m calling is {MySuiteCRMInstance}/Api/V8/module

This is the only suitecrm instance I created, the installation has been running for a month approximately, I have not migrated or anything.

If you need any further information, please let me know.

There’s a PR that is critical to apply if you’re running 7.11.8, this one:

And then run a Admin / Repairs / Rebuild .htaccess

Tell me if that fixes anything.

Unfortunately, the error still remains.

I’m sorry, I don’t know much about the API, unfortunately.

Have you checked both your logs at the time of the error?