It could likely be a problem with encoding.
- Can you download the files - are they of right size?
- For text files: did you see the content by forcibly opening on a text editor like Notepad? If you can see the content, change the file encoding and reupload to Salesforce. Will this make the problem go away?
A simple test: Get Base64 encoded string from file, invoke REST API & check whether the file goes through.
CURL -
curl <url>/Document/ -H "Authorization: Bearer token" -H "Content-Type: multipart/form-data; boundary=\"boundary_string\"" --data-binary @att_test.json
att_test.JSON -
--boundary_string
Content-Disposition: form-data; name="entity_attachment";
Content-Type: application/json
{
"FolderId":"00l1J000001H2aIQAS",
"Name":"Sample File"
}
--boundary_string
Content-Type: application/jpg
Content-Disposition: form-data; name="Body"; filename="test.jpg"
<<encoded_string_here>>