Can not open attachment created via set_note_attachment

Using rest …/service/v4_1/rest.php
Suitecrm 7.8.13
Building a contact us page to create a case with adding file upload capabilities, I want to avoid using portal due to database incompabilities encountered using MS-SQL…

I can create a case and a note with no problem.
I can attach a note to a case with no problem.
I can add a file to the note with some issues being that I can not open that file when I try to open it from SuiteCRM, the file is invalid.

2 issues I noticed:

1 - if I add a file/note to a case manually via normal gui, the test image file size is 1364kb
but if I add the file via rest api the file is somewhat slimmer 1342kb
if I try to open with most paint program I simply get an error but gimp says “damaged file” which make sense as per above notice.

2- if I look at the notes table itself:
the file_mime_type for the file added manually it shows image/png
but the one created with the api shows " application/octet-stream" (notice the space at the bigginning (?)

I suspect the file_mime_type is the culprit but do not know where to look…
Would the set_note_attachment find the mime type or do I have to set it manually?

Thank you